[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5334) PersistenceUtilHelpe.findMember(Class, String) private method doesn't work with members of a superclass

Valentino Proietti (JIRA) noreply at atlassian.com
Wed Jun 23 09:47:09 EDT 2010


PersistenceUtilHelpe.findMember(Class, String) private method doesn't work with members of a superclass
-------------------------------------------------------------------------------------------------------

                 Key: HHH-5334
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5334
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 3.5.3
            Reporter: Valentino Proietti


It is clear to me that the line:
final Method method = getMethod( clazz, property );
should be replaced with:
final Method method = getMethod( current, property );

Thanks

private Member findMember(Class<?> clazz, String property) {
	final List<Class<?>> classes = getClassHierarchy( clazz );

	for (Class current : classes) {
		final Field field;
		try {
			field = current.getDeclaredField( property );
			setAccessibility( field );
			return field;
		}
		catch ( NoSuchFieldException e ) {
			final Method method = getMethod( clazz, property );
			if (method != null) {
				setAccessibility( method );
				return method;
			}
		}
	}
	//we could not find any match
	throw new PersistenceException( "Unable to find field or method: "
					+ clazz + "#"
					+ property);
}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list