PojoEntityTuplizer.getPropertyValue throws unspecified NullPointerException when
requesting non-existing property
-----------------------------------------------------------------------------------------------------------------
Key: HHH-6778
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6778
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.7
Reporter: Jiri Mares
Priority: Critical
{code}
public Object getPropertyValue(Object entity, String propertyPath) throws
HibernateException {
int loc = propertyPath.indexOf('.');
String basePropertyName = loc > 0
? propertyPath.substring( 0, loc )
: propertyPath;
//final int index = entityMetamodel.getPropertyIndexOrNull( basePropertyName );
Integer index = entityMetamodel.getPropertyIndexOrNull( basePropertyName );
if (index == null) {
propertyPath = "_identifierMapper." + propertyPath;
loc = propertyPath.indexOf('.');
basePropertyName = loc > 0
? propertyPath.substring( 0, loc )
: propertyPath;
}
index = entityMetamodel.getPropertyIndexOrNull( basePropertyName );
final Object baseValue = getPropertyValue( entity, index.intValue() );
if ( loc > 0 ) {
if ( baseValue == null ) {
return null;
}
return getComponentValue(
(ComponentType) entityMetamodel.getPropertyTypes()[index.intValue()],
baseValue,
propertyPath.substring(loc+1)
);
}
else {
return baseValue;
}
}
{code}
problem is on this line
{code}
final Object baseValue = getPropertyValue( entity, index.intValue() );
{code}
where {{index}} is used eventhough can be {{null}}.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira