JDK-8172297 : In java 8, the marshalling with JAX-WS does not escape carriage return
  • Type: Bug
  • Component: xml
  • Sub-Component: jax-ws
  • Affected Version: 8u102
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-01-05
  • Updated: 2018-07-06
  • Resolved: 2017-06-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
JAXWS implementation incorrectly processes new line and carriage-return symbols in webservice string parameters.
In case of simple WS that echoes input parameter the reponse returned to the client differs from the parameter value sent in request.
For example, WS can be illustrated by such implementation:
    @WebService(endpointInterface = "ws.HelloWorld")
    public class HelloWorldImpl implements HelloWorld {

        public String getHelloWorldAsString(String name) {
            System.out.println("Server-side parameter value: '"
                    + name.replaceAll("\r", "#CR")
                          .replaceAll("\n", "#NL") + "'");
            return name;

and usage of WS:
    String response = hello.getHelloWorldAsString(request);

After the round trip client/server communication the following values can be observed:
request value:'CarrigeReturn and NewLine symbols:#CR#NL#NL#CR#CR#NL'
server-side value:'CarrigeReturn and NewLine symbols:#NL#NL#NL#NL'
sesponse value:'CarrigeReturn and NewLine symbols:#NL#NL#NL#NL'
JDK8 review: http://mail.openjdk.java.net/pipermail/jdk8u-dev/2017-June/006720.html

For JDK9 this issue will be addressed by JAX-WS RI sync bug: JDK-8176508 JDK8 fix will be delivered under this bugID - the partial backport of the sync changeset will be prepared.

JDK7 JAXWS implementation correctly processes the string parameters values with carriage-return and new-line symbols