mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-09 12:44:49 +00:00
HHH-8068 formatting and cleanup
This commit is contained in:
parent
d0a7a017a5
commit
8ccbd7d121
@ -185,20 +185,20 @@ private Constructor resolveConstructor(String path) throws SemanticException {
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
// 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();
|
||||
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",
|
||||
return String.format( "Unable to locate appropriate constructor on class [%s]. Expected arguments are: %s",
|
||||
className, formattedList );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user