← Back to team overview

dhis2-devs team mailing list archive

[Bug 1438624] Re: XML dxf2 import: Use of ampersand (&) causes crash

 

Hi Calle,

this is not really a DHIS 2 bug.  The XML spec clearly defines that
special characters such as < and & must be escaped into &amp; and &lt; .
When you export such values from DHIS 2 such characters are properly
escaped.


regards,

Lars



** Changed in: dhis2
       Status: New => Invalid

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

Title:
  XML dxf2 import: Use of ampersand (&) causes crash

Status in DHIS 2:
  Invalid

Bug description:
  When importing a dxf2 (XML) data file that includes one or more
  ampersands in e.g. the comment field, it causes a crash. See the
  tomcat log below - the import process is obviously unable to handle
  the ampersand (code 32) character - and possibly a number of other
  characters too.

  None of this is mentioned in the manuals, though, where the "comment"
  field is only referred to as a "free text" field with no further
  restrictions.

  There are two solutions here: 
  1. The import process is modified to handle "unexpected" characters automatically
  2. A list of "unexpected" characters are published as prohibited (and they should be disallowed within DHIS2 also, then) with a more user-friendly error message when they are encountered.

  Regards
  Calle

  * ERROR 2015-03-31 12:00:04,003 org.amplecode.staxwax.XMLException: Failed to move to start element
          at org.amplecode.staxwax.reader.DefaultXMLStreamReader.moveToStartElement(DefaultXMLStreamReader.java:130)
          at org.hisp.dhis.dxf2.datavalueset.StreamingDataValueSet.hasNextDataValue(StreamingDataValueSet.java:136)
          at org.hisp.dhis.dxf2.datavalueset.DefaultDataValueSetService.saveDataValueSet(DefaultDataValueSetService.ja
          at org.hisp.dhis.dxf2.datavalueset.DefaultDataValueSetService.saveDataValueSet(DefaultDataValueSetService.ja
          at org.hisp.dhis.importexport.action.util.ImportDataValueTask.run(ImportDataValueTask.java:91)
          at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnabl
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
          at java.util.concurrent.FutureTask.run(FutureTask.java:262)
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecut
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java
          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:745)
  Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' ' (code 32) (missing name?)
   at [row,col {unknown-source}]: [15,162]
          at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:647)
          at com.ctc.wstx.sr.StreamScanner.parseFullName(StreamScanner.java:1931)
          at com.ctc.wstx.sr.StreamScanner.parseEntityName(StreamScanner.java:2057)
          at com.ctc.wstx.sr.StreamScanner.fullyResolveEntity(StreamScanner.java:1525)
          at com.ctc.wstx.sr.BasicStreamReader.parseAttrValue(BasicStreamReader.java:1938)
          at com.ctc.wstx.sr.BasicStreamReader.handleNsAttrs(BasicStreamReader.java:3065)
          at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2963)
          at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2839)
          at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1073)
          at org.amplecode.staxwax.reader.DefaultXMLStreamReader.moveToStartElement(DefaultXMLStreamReader.java:113)

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


Follow ups

References