------------------------------------------------------------
revno: 6755
committer: Lars Helge Overland <[email protected]>
branch nick: dhis2
timestamp: Thu 2012-04-26 12:56:58 +0200
message:
  Writing empty string instead of null in report table data
modified:
  
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JacksonRowDataSerializer.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-api/src/main/java/org/hisp/dhis/common/adapter/JacksonRowDataSerializer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JacksonRowDataSerializer.java	2012-04-26 07:56:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JacksonRowDataSerializer.java	2012-04-26 10:56:58 +0000
@@ -42,6 +42,7 @@
 {
     private static final String ROW_NAME = "row";
     private static final String FIELD_NAME = "field";
+    private static final String EMPTY = "";
     
     @Override
     public void serialize( List<List<Object>> values, JsonGenerator jgen, SerializerProvider provider ) throws IOException
@@ -61,7 +62,9 @@
 
             for ( Object object : value )
             {
-                jgen.writeStringField( FIELD_NAME, "" + object );
+                object = object == null ? EMPTY : object;
+                    
+                jgen.writeStringField( FIELD_NAME, String.valueOf( object ) );
             }
 
             jgen.writeEndObject();

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to