diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/ConstructorNode.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/ConstructorNode.java index fd9fbdb45b..d2e2dc8439 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/ConstructorNode.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/ConstructorNode.java @@ -185,22 +185,22 @@ public class ConstructorNode extends SelectExpressionList implements AggregatedS catch ( PropertyNotFoundException e ) { // this is the exception returned by ReflectHelper.getConstructor() if it cannot // locate an appropriate constructor - String formattedMessage = formatMissingContructorExceptionMessage(className); - throw new DetailedSemanticException( formattedMessage, e ); + throw new DetailedSemanticException( formatMissingContructorExceptionMessage( className ), e ); } } - private String formatMissingContructorExceptionMessage(String className) { - String[] params = new String[constructorArgumentTypes.length]; - for ( int j = 0; j < constructorArgumentTypes.length; j++ ) { - params[j] = constructorArgumentTypes[j] instanceof PrimitiveType ? - ( ( PrimitiveType ) constructorArgumentTypes[j] ).getPrimitiveClass().getName() : - constructorArgumentTypes[j].getReturnedClass().getName(); - } - String formattedList = params.length == 0 ? "no arguments constructor" : StringHelper.join(", ", params); - return String.format( "Unable to locate appropriate constructor on class [%s]. Expected types are: %s", - className, formattedList ); - } + // HHH-8068 -- provide a more helpful message + private String formatMissingContructorExceptionMessage(String className) { + String[] params = new String[constructorArgumentTypes.length]; + for ( int j = 0; j < constructorArgumentTypes.length; j++ ) { + params[j] = constructorArgumentTypes[j] instanceof PrimitiveType + ? ( (PrimitiveType) constructorArgumentTypes[j] ).getPrimitiveClass().getName() + : constructorArgumentTypes[j].getReturnedClass().getName(); + } + String formattedList = params.length == 0 ? "no arguments constructor" : StringHelper.join( ", ", params ); + return String.format( "Unable to locate appropriate constructor on class [%s]. Expected arguments are: %s", + className, formattedList ); + } public Constructor getConstructor() { return constructor;