← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15420: in expression extracter in IdObjectImporter, make sure that type is Expression (could clash with ...

 

------------------------------------------------------------
revno: 15420
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-05-26 16:44:19 +0200
message:
  in expression extracter in IdObjectImporter, make sure that type is Expression (could clash with ProgramExpression etc)
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2014-05-26 12:44:15 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2014-05-26 14:44:19 +0000
@@ -114,7 +114,7 @@
     @Autowired
     private AclService aclService;
 
-    @Autowired( required = false )
+    @Autowired(required = false)
     private List<ObjectHandler<T>> objectHandlers;
 
     //-------------------------------------------------------------------------------------------------------
@@ -231,19 +231,17 @@
 
         private Expression extractExpression( T object, String fieldName )
         {
-            Expression expression = null;
-
             if ( ReflectionUtils.findGetterMethod( fieldName, object ) != null )
             {
-                expression = ReflectionUtils.invokeGetterMethod( fieldName, object );
+                Object expression = ReflectionUtils.invokeGetterMethod( fieldName, object );
 
-                if ( expression != null )
+                if ( expression != null && Expression.class.isAssignableFrom( expression.getClass() ) )
                 {
                     ReflectionUtils.invokeSetterMethod( fieldName, object, new Object[]{ null } );
                 }
             }
 
-            return expression;
+            return null;
         }
 
         private Set<DataElementOperand> extractDataElementOperands( T object, String fieldName )