← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12972: minor fix in event coordinate parsing

 

------------------------------------------------------------
revno: 12972
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-11-19 13:09:47 +0100
message:
  minor fix in event coordinate parsing
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/DefaultEventStore.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/event/DefaultEventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/DefaultEventStore.java	2013-11-19 10:21:42 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/DefaultEventStore.java	2013-11-19 12:09:47 +0000
@@ -40,6 +40,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.support.rowset.SqlRowSet;
+import org.springframework.util.StringUtils;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -185,22 +186,25 @@
                     Coordinate coordinate = new Coordinate();
                     String psi_coordinates = rowSet.getString( "psi_coordinates" );
 
-                    try
-                    {
-                        List<Double> list = objectMapper.readValue( psi_coordinates, new TypeReference<List<Double>>()
-                        {
-                        } );
-
-                        coordinate.setLongitude( list.get( 0 ) );
-                        coordinate.setLatitude( list.get( 1 ) );
-                    }
-                    catch ( IOException ignored )
-                    {
-                    }
-
-                    if ( coordinate.isValid() )
-                    {
-                        event.setCoordinate( coordinate );
+                    if ( !StringUtils.isEmpty( psi_coordinates ) )
+                    {
+                        try
+                        {
+                            List<Double> list = objectMapper.readValue( psi_coordinates, new TypeReference<List<Double>>()
+                            {
+                            } );
+
+                            coordinate.setLongitude( list.get( 0 ) );
+                            coordinate.setLatitude( list.get( 1 ) );
+                        }
+                        catch ( IOException ignored )
+                        {
+                        }
+
+                        if ( coordinate.isValid() )
+                        {
+                            event.setCoordinate( coordinate );
+                        }
                     }
                 }