← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22286: Event, TEI, enrollment import. Catching JsonMappingException for detecting multiple/single objec...

 

------------------------------------------------------------
revno: 22286
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2016-03-14 09:42:31 +0100
message:
  Event, TEI, enrollment import. Catching JsonMappingException  for detecting multiple/single object instances to reduce hiding of real exceptions.
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/JacksonEnrollmentService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JacksonEventService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/JacksonTrackedEntityInstanceService.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/events/enrollment/JacksonEnrollmentService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/JacksonEnrollmentService.java	2016-03-13 19:11:34 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/JacksonEnrollmentService.java	2016-03-14 08:42:31 +0000
@@ -29,8 +29,8 @@
  */
 
 import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;
 import com.fasterxml.jackson.dataformat.xml.XmlMapper;
 import org.hisp.dhis.dxf2.common.ImportOptions;
 import org.hisp.dhis.dxf2.importsummary.ImportSummaries;
@@ -109,7 +109,7 @@
             Enrollments fromJson = fromJson( input, Enrollments.class );
             enrollments.addAll( fromJson.getEnrollments() );
         }
-        catch ( UnrecognizedPropertyException ex )
+        catch ( JsonMappingException ex )
         {
             Enrollment fromJson = fromJson( input, Enrollment.class );
             enrollments.add( fromJson );
@@ -129,7 +129,7 @@
             Enrollments fromXml = fromXml( input, Enrollments.class );
             enrollments.addAll( fromXml.getEnrollments() );
         }
-        catch ( UnrecognizedPropertyException ex )
+        catch ( JsonMappingException ex )
         {
             Enrollment fromXml = fromXml( input, Enrollment.class );
             enrollments.add( fromXml );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JacksonEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JacksonEventService.java	2016-03-13 19:11:34 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JacksonEventService.java	2016-03-14 08:42:31 +0000
@@ -29,8 +29,8 @@
  */
 
 import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;
 import com.fasterxml.jackson.dataformat.xml.XmlMapper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -102,7 +102,7 @@
             Events fromXml = fromXml( input, Events.class );
             events.addAll( fromXml.getEvents() );
         }
-        catch ( UnrecognizedPropertyException ex )
+        catch ( JsonMappingException ex )
         {
             Event fromXml = fromXml( input, Event.class );
             events.add( fromXml );
@@ -122,7 +122,7 @@
             Events fromXml = fromJson( input, Events.class );
             events.addAll( fromXml.getEvents() );
         }
-        catch ( UnrecognizedPropertyException ex )
+        catch ( JsonMappingException ex )
         {
             Event fromXml = fromJson( input, Event.class );
             events.add( fromXml );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/JacksonTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/JacksonTrackedEntityInstanceService.java	2016-03-13 19:11:34 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/JacksonTrackedEntityInstanceService.java	2016-03-14 08:42:31 +0000
@@ -29,8 +29,8 @@
  */
 
 import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;
 import com.fasterxml.jackson.dataformat.xml.XmlMapper;
 import org.hisp.dhis.dxf2.common.ImportOptions;
 import org.hisp.dhis.dxf2.importsummary.ImportSummaries;
@@ -109,7 +109,7 @@
             TrackedEntityInstances fromXml = fromXml( input, TrackedEntityInstances.class );
             trackedEntityInstances.addAll( fromXml.getTrackedEntityInstances() );
         }
-        catch ( UnrecognizedPropertyException ex )
+        catch ( JsonMappingException ex )
         {
             TrackedEntityInstance fromXml = fromXml( input, TrackedEntityInstance.class );
             trackedEntityInstances.add( fromXml );
@@ -129,7 +129,7 @@
             TrackedEntityInstances fromJson = fromJson( input, TrackedEntityInstances.class );
             trackedEntityInstances.addAll( fromJson.getTrackedEntityInstances() );
         }
-        catch ( UnrecognizedPropertyException ex )
+        catch ( JsonMappingException ex )
         {
             TrackedEntityInstance fromJson = fromJson( input, TrackedEntityInstance.class );
             trackedEntityInstances.add( fromJson );