HHH-8816 - Unable to instantiate AttributeConverter: root cause of exception hidden

This commit is contained in:
Steve Ebersole 2014-03-20 09:33:00 -05:00
parent fc577724fb
commit d023c7c95c
1 changed files with 12 additions and 14 deletions

View File

@ -2629,16 +2629,24 @@ public class Configuration implements Serializable {
* by its "entity attribute" parameterized type?
*/
public void addAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass, boolean autoApply) {
final AttributeConverter attributeConverter;
addAttributeConverter(
instantiateAttributeConverter( attributeConverterClass ),
autoApply
);
}
private AttributeConverter instantiateAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass) {
AttributeConverter attributeConverter;
try {
attributeConverter = attributeConverterClass.newInstance();
}
catch (Exception e) {
throw new AnnotationException(
"Unable to instantiate AttributeConverter [" + attributeConverterClass.getName() + "]"
"Unable to instantiate AttributeConverter [" + attributeConverterClass.getName() + "]",
e
);
}
addAttributeConverter( attributeConverter, autoApply );
return attributeConverter;
}
/**
@ -2647,17 +2655,7 @@ public class Configuration implements Serializable {
* @param attributeConverterClass The AttributeConverter class.
*/
public void addAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass) {
final AttributeConverter attributeConverter;
try {
attributeConverter = attributeConverterClass.newInstance();
}
catch (Exception e) {
throw new AnnotationException(
"Unable to instantiate AttributeConverter [" + attributeConverterClass.getName() + "]"
);
}
addAttributeConverter( attributeConverter );
addAttributeConverter( instantiateAttributeConverter( attributeConverterClass ) );
}
/**