Axis2
  1. Axis2
  2. AXIS2-5207

JSON formatted content gives an error if there is a line break ('\n') or tab space ('\t') or carriage return ('\r') after the first curly bracket

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.7.0
    • Fix Version/s: 1.6.2, 1.7.0
    • Component/s: json
    • Labels:
      None

      Description

      A sample JSON (having a line break at the first line) which causes the error is;

      {
      "Hi_ABC": [

      {"abc": "PPP-TEST_11"}

      ,

      {"abc": "QQQ-Test1"}

      ]}

      The error log;

      [2011-11-16 16:32:00,125] ERROR - OMSourcedElementImpl Could not get parser from data source for element
      "Hi_ABC"
      javax.xml.stream.XMLStreamException
      at org.codehaus.jettison.mapped.MappedXMLInputFactory.createXMLStreamReader(MappedXMLInputFactory.java:46)
      at org.apache.axis2.json.JSONDataSource.getReader(JSONDataSource.java:56)
      at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:225)
      at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.forceExpand(OMSourcedElementImpl.java:254)
      at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:685)
      at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:556)
      at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)
      at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:230)
      at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:125)
      at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:113)
      at org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:988)
      at java.lang.String.valueOf(String.java:2826)
      at java.lang.StringBuffer.append(StringBuffer.java:219)
      at org.apache.synapse.mediators.builtin.LogMediator.getFullLogMessage(LogMediator.java:184)
      at org.apache.synapse.mediators.builtin.LogMediator.getLogMessage(LogMediator.java:123)
      at org.apache.synapse.mediators.builtin.LogMediator.mediate(LogMediator.java:91)
      at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:60)
      at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
      at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:154)
      at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
      at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
      at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:408)
      at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:259)
      at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
      [2011-11-16 16:32:00,127] ERROR - NativeWorkerPool Uncaught exception
      java.lang.RuntimeException: Error obtaining parser from data source:null
      at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:230)
      at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.forceExpand(OMSourcedElementImpl.java:254)
      at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:685)
      at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:556)
      at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)
      at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:230)
      at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:125)
      at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:113)
      at org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:988)
      at java.lang.String.valueOf(String.java:2826)
      at java.lang.StringBuffer.append(StringBuffer.java:219)
      at org.apache.synapse.mediators.builtin.LogMediator.getFullLogMessage(LogMediator.java:184)
      at org.apache.synapse.mediators.builtin.LogMediator.getLogMessage(LogMediator.java:123)
      at org.apache.synapse.mediators.builtin.LogMediator.mediate(LogMediator.java:91)
      at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:60)
      at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
      at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:154)
      at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
      at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
      at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:408)
      at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:259)
      at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)

      With the CRLF after the first curly bracket throws following error.
      'Could not get parser from data source for element ^M"Hi_ABC"' (^M = ascii 0x0D):

      INFO | jvm 1 | 2011/11/28 09:37:43 | [2011-11-28 09:37:43,749] DEBUG - TransportUtils createSOAPEnvelope using Builder (class org.apache.synapse.commons.builders.XFormURLEncode
      dBuilder) selected from type (application/x-www-form-urlencoded)
      INFO | jvm 1 | 2011/11/28 09:37:43 | [2011-11-28 09:37:43,750] INFO - LogMediator To: /services/JSONTestProxy, MessageID:

      1. axis2_5207.patch
        0.6 kB
        Thilini Ishaka

        Activity

        Hide
        Thilini Ishaka added a comment -

        I have created a patch to resolve this issue. Please apply the patch.

        Thanks
        Thilini

        Show
        Thilini Ishaka added a comment - I have created a patch to resolve this issue. Please apply the patch. Thanks Thilini
        Hide
        Hudson added a comment -

        Integrated in Axis2 #1174 (See https://builds.apache.org/job/Axis2/1174/)
        Applied patch for AXIS2-5207.

        sagara :
        Files :

        • /axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONOMBuilder.java
        Show
        Hudson added a comment - Integrated in Axis2 #1174 (See https://builds.apache.org/job/Axis2/1174/ ) Applied patch for AXIS2-5207 . sagara : Files : /axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONOMBuilder.java

          People

          • Assignee:
            Unassigned
            Reporter:
            Thilini Ishaka
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development