HHH-8068 formatting and cleanup
This commit is contained in:
parent
5cf46b4eb6
commit
e66b5ab79d
|
@ -185,22 +185,22 @@ public class ConstructorNode extends SelectExpressionList implements AggregatedS
|
||||||
catch ( PropertyNotFoundException e ) {
|
catch ( PropertyNotFoundException e ) {
|
||||||
// this is the exception returned by ReflectHelper.getConstructor() if it cannot
|
// this is the exception returned by ReflectHelper.getConstructor() if it cannot
|
||||||
// locate an appropriate constructor
|
// locate an appropriate constructor
|
||||||
String formattedMessage = formatMissingContructorExceptionMessage(className);
|
throw new DetailedSemanticException( formatMissingContructorExceptionMessage( className ), e );
|
||||||
throw new DetailedSemanticException( formattedMessage, e );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatMissingContructorExceptionMessage(String className) {
|
// HHH-8068 -- provide a more helpful message
|
||||||
String[] params = new String[constructorArgumentTypes.length];
|
private String formatMissingContructorExceptionMessage(String className) {
|
||||||
for ( int j = 0; j < constructorArgumentTypes.length; j++ ) {
|
String[] params = new String[constructorArgumentTypes.length];
|
||||||
params[j] = constructorArgumentTypes[j] instanceof PrimitiveType ?
|
for ( int j = 0; j < constructorArgumentTypes.length; j++ ) {
|
||||||
( ( PrimitiveType ) constructorArgumentTypes[j] ).getPrimitiveClass().getName() :
|
params[j] = constructorArgumentTypes[j] instanceof PrimitiveType
|
||||||
constructorArgumentTypes[j].getReturnedClass().getName();
|
? ( (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",
|
String formattedList = params.length == 0 ? "no arguments constructor" : StringHelper.join( ", ", params );
|
||||||
className, formattedList );
|
return String.format( "Unable to locate appropriate constructor on class [%s]. Expected arguments are: %s",
|
||||||
}
|
className, formattedList );
|
||||||
|
}
|
||||||
|
|
||||||
public Constructor getConstructor() {
|
public Constructor getConstructor() {
|
||||||
return constructor;
|
return constructor;
|
||||||
|
|
Loading…
Reference in New Issue