=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2012-10-01 10:50:34 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2012-11-14 09:14:44 +0000 @@ -616,12 +616,12 @@ for ( NameableObject object : objects1 ) { - identifiers.add( getIdentifier( object.getClass(), object.getId() ) ); + identifiers.add( getIdentifier( getNameableClass( object.getClass() ), object.getId() ) ); } for ( NameableObject object : objects2 ) { - identifiers.add( getIdentifier( object.getClass(), object.getId() ) ); + identifiers.add( getIdentifier( getNameableClass( object.getClass() ), object.getId() ) ); } return getIdentifier( identifiers.toArray( SRT ) ); @@ -636,7 +636,7 @@ for ( NameableObject object : objects ) { - identifiers.add( getIdentifier( object.getClass(), object.getId() ) ); + identifiers.add( getIdentifier( getNameableClass( object.getClass() ), object.getId() ) ); } identifiers.add( getIdentifier( clazz, id ) ); @@ -904,6 +904,25 @@ throw new IllegalStateException( falseMessage ); } } + + /** + * Gets the real Nameable class in case of a proxy. + */ + @SuppressWarnings("unchecked") + public static Class getNameableClass( Class clazz ) + { + while ( clazz != null ) + { + if ( BaseNameableObject.class.equals( clazz.getSuperclass() ) ) + { + return (Class) clazz; + } + + clazz = clazz.getSuperclass(); + } + + throw new IllegalStateException( "Class is not a Nameable object: " + clazz ); + } // ------------------------------------------------------------------------- // Equals and hashCode === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java 2012-07-30 10:56:25 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java 2012-11-14 09:14:44 +0000 @@ -391,10 +391,12 @@ try { return (T) method.invoke( target, args ); - } catch ( InvocationTargetException e ) + } + catch ( InvocationTargetException e ) { throw new RuntimeException( e ); - } catch ( IllegalAccessException e ) + } + catch ( IllegalAccessException e ) { throw new RuntimeException( e ); }