dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #43918
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22279: Event, TEI, enrollment import. Catching UnrecognizedPropertyException instad of catch-all Excepti...
------------------------------------------------------------
revno: 22279
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2016-03-13 20:11:34 +0100
message:
Event, TEI, enrollment import. Catching UnrecognizedPropertyException instad of catch-all Exception 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-01-04 02:27:49 +0000
+++ 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
@@ -30,6 +30,7 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
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;
@@ -108,7 +109,7 @@
Enrollments fromJson = fromJson( input, Enrollments.class );
enrollments.addAll( fromJson.getEnrollments() );
}
- catch ( Exception ex )
+ catch ( UnrecognizedPropertyException ex )
{
Enrollment fromJson = fromJson( input, Enrollment.class );
enrollments.add( fromJson );
@@ -128,7 +129,7 @@
Enrollments fromXml = fromXml( input, Enrollments.class );
enrollments.addAll( fromXml.getEnrollments() );
}
- catch ( Exception ex )
+ catch ( UnrecognizedPropertyException 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-01-04 02:27:49 +0000
+++ 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
@@ -30,6 +30,7 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
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;
@@ -101,7 +102,7 @@
Events fromXml = fromXml( input, Events.class );
events.addAll( fromXml.getEvents() );
}
- catch ( Exception ex )
+ catch ( UnrecognizedPropertyException ex )
{
Event fromXml = fromXml( input, Event.class );
events.add( fromXml );
@@ -121,7 +122,7 @@
Events fromXml = fromJson( input, Events.class );
events.addAll( fromXml.getEvents() );
}
- catch ( Exception ex )
+ catch ( UnrecognizedPropertyException 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-01-04 02:27:49 +0000
+++ 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
@@ -30,6 +30,7 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
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;
@@ -108,7 +109,7 @@
TrackedEntityInstances fromXml = fromXml( input, TrackedEntityInstances.class );
trackedEntityInstances.addAll( fromXml.getTrackedEntityInstances() );
}
- catch ( Exception ex )
+ catch ( UnrecognizedPropertyException ex )
{
TrackedEntityInstance fromXml = fromXml( input, TrackedEntityInstance.class );
trackedEntityInstances.add( fromXml );
@@ -128,7 +129,7 @@
TrackedEntityInstances fromJson = fromJson( input, TrackedEntityInstances.class );
trackedEntityInstances.addAll( fromJson.getTrackedEntityInstances() );
}
- catch ( Exception ex )
+ catch ( UnrecognizedPropertyException ex )
{
TrackedEntityInstance fromJson = fromJson( input, TrackedEntityInstance.class );
trackedEntityInstances.add( fromJson );