Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8203676

Cannot parse XML new line character

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 7 64 bit
      JDK 8 build 162

      A DESCRIPTION OF THE PROBLEM :
      We were using JDK 8 build 141 and we did not encounter this issue. I also tested with build 102 and it was ok.

      I encountered this issue when using build 161 and 162.

      The problem is that when a SOAP request returns an error, we get this response:
      "
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>Marshalling Error: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified. </faultstring>
      </soap:Fault>
      </soap:Body>
      </soap:Envelope>
      "

      The error message that is supposed to be returned is:
      "
      java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: ORA-00904: "Obj": invalid identifier\n
      "

      As you could see there is a new line character(\n) at the end of the error message. This was not added by us, but is part of the SQLException error message that we get back from the database. Anyway, new line character is a valid XML character.

      I see that the CXF framework is using an interceptor (WebFaultOutInterceptor) to write out the response. This interceptor is using a default XML marshaller (com.sun.xml.internal.bind.v2.runtime.MarshallerImpl) to write out the response, which throws the error above.
      If I remove the new line character from the end of the error message, the proper response is returned. But, as the new line character is a valid XML character and we did not encounter this issue in build 141, I assume this is a bug.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      See above

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Should be able to parse an XML response that contains a new line character (\n) as this is a valid XML character.

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              psonal Pallavi Sonal (Inactive)
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: