diff -r b344704b05a1 -r e716ed4b0efb src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/output/XMLStreamWriterOutput.java --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/output/XMLStreamWriterOutput.java Tue Apr 03 17:09:13 2018 -0700 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/output/XMLStreamWriterOutput.java Mon Apr 23 13:24:44 2018 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,7 @@ import javax.xml.stream.XMLStreamWriter; import com.sun.xml.internal.bind.marshaller.CharacterEscapeHandler; +import com.sun.xml.internal.bind.marshaller.NoEscapeHandler; import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; @@ -71,7 +72,7 @@ } CharacterEscapeHandler xmlStreamEscapeHandler = escapeHandler != null ? - escapeHandler : NewLineEscapeHandler.theInstance; + escapeHandler : NoEscapeHandler.theInstance; // otherwise the normal writer. return new XMLStreamWriterOutput(out, xmlStreamEscapeHandler); @@ -217,45 +218,6 @@ } } - - /** - * Performs character escaping only for new lines. - */ - private static class NewLineEscapeHandler implements CharacterEscapeHandler { - - public static final NewLineEscapeHandler theInstance = new NewLineEscapeHandler(); - - @Override - public void escape(char[] ch, int start, int length, boolean isAttVal, Writer out) throws IOException { - int limit = start+length; - int lastEscaped = start; - - for (int i = start; i < limit; i++) { - char c = ch[i]; - if (c == '\r' || c == '\n') { - if (i != lastEscaped) { - out.write(ch, lastEscaped, i - lastEscaped); - } - lastEscaped = i + 1; - if (out instanceof XmlStreamOutWriterAdapter) { - try { - ((XmlStreamOutWriterAdapter)out).writeEntityRef("#x" + Integer.toHexString(c)); - } catch (XMLStreamException e) { - throw new IOException("Error writing xml stream", e); - } - } else { - out.write("&#x"); - out.write(Integer.toHexString(c)); - out.write(';'); - } - } - } - if (lastEscaped != limit) { - out.write(ch, lastEscaped, length - lastEscaped); - } - } - } - private static final class XmlStreamOutWriterAdapter extends Writer { private final XMLStreamWriter writer;