← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10348: minor fixes to importer

 

------------------------------------------------------------
revno: 10348
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-03-20 18:24:42 +0700
message:
  minor fixes to importer
modified:
  dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportMetaDataTask.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-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportMetaDataTask.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportMetaDataTask.java	2013-03-16 14:22:03 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportMetaDataTask.java	2013-03-20 11:24:42 +0000
@@ -73,13 +73,20 @@
 
         try
         {
-            // TODO check for XML/JSON
+            // TODO should probably sniff if its xml or json, but this works for now
             metaData = JacksonUtils.fromXml( inputStream, MetaData.class );
         }
-        catch ( IOException e )
+        catch ( IOException ignored )
         {
-            log.error( "(IOException) Unable to parse meta-data while reading input stream" );
-            return;
+            try
+            {
+                metaData = JacksonUtils.fromJson( inputStream, MetaData.class );
+            }
+            catch ( IOException e )
+            {
+                log.error( "(IOException) Unable to parse meta-data while reading input stream" );
+                return;
+            }
         }
 
         importService.importMetaData( userUid, metaData, importOptions, taskId );