← Back to team overview

dhis2-devs team mailing list archive

[Bug 1235288] Re: Import Meta-Data JSON throws exception

 

Hi,

I assume this was done through the web-UI, and not the web-API? I'm
sorry, but currently only XML is supported when importing through the
UI.

If you want to import json, you can run this command:
curl -X POST -d @file.json -u username:password -H "Content-Type: application/json" http://server/api/metaData

-- 
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/1235288

Title:
  Import Meta-Data JSON throws exception

Status in DHIS 2:
  New

Bug description:
  When importing meta-data in JSON format the following exception is
  thrown:

  * INFO  2013-10-04 15:32:53,282 Export done at Fri Oct 04 15:32:53 BST 2013 (DefaultExportService.java [http-apr-8080-exec-9])
  * ERROR 2013-10-04 15:33:14,789 (IOException) Unable to parse meta-data while reading input stream (ImportMetaDataTask.java [taskScheduler-1])
  com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'tUpdated': was expecting 'null', 'true', 'false' or NaN
   at [Source: java.io.BufferedInputStream@754525d2; line: 1, column: 10]
          at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1284)
          at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:588)
          at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken(UTF8StreamJsonParser.java:2278)
          at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._matchToken(UTF8StreamJsonParser.java:2236)
          at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:587)
          at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:498)
          at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:2618)
          at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2565)
          at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1856)
          at org.hisp.dhis.dxf2.utils.JacksonUtils.fromJson(JacksonUtils.java:160)
          at org.hisp.dhis.importexport.action.util.ImportMetaDataTask.run(ImportMetaDataTask.java:84)
          at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
          at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
          at java.util.concurrent.FutureTask.run(FutureTask.java:166)
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:724)

  
  Test:
  1. Export meta data in uncompressed JSON format.
  2. Import the MetaData.json file on the same instance.

  Replicable with different instances of dhis2. Tests made on dhis 2.13.

  Attatched is the json that provoced the above error.

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1235288/+subscriptions


References