--- old/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/MarshallerImpl.java 2017-06-01 18:20:49.385569719 +0100 +++ new/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/MarshallerImpl.java 2017-06-01 18:20:49.329569719 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -165,7 +165,7 @@ @Override public void marshal(Object obj, XMLStreamWriter writer) throws JAXBException { - write(obj, XMLStreamWriterOutput.create(writer,context), new StAXPostInitAction(writer,serializer)); + write(obj, XMLStreamWriterOutput.create(writer,context, escapeHandler), new StAXPostInitAction(writer,serializer)); } @Override @@ -371,6 +371,15 @@ } + /** + * Returns escape handler provided with JAXB context parameters. + * + * @return escape handler + */ + CharacterEscapeHandler getEscapeHandler() { + return escapeHandler; + } + // // // create XMLWriter by specifing various type of output. @@ -436,13 +445,14 @@ if(encoding.equals("UTF-8")) { Encoded[] table = context.getUTF8NameTable(); final UTF8XmlOutput out; + CharacterEscapeHandler ceh = createEscapeHandler(encoding); if(isFormattedOutput()) - out = new IndentingUTF8XmlOutput(os, indent, table, escapeHandler); + out = new IndentingUTF8XmlOutput(os, indent, table, ceh); else { if(c14nSupport) - out = new C14nXmlOutput(os, table, context.c14nSupport, escapeHandler); + out = new C14nXmlOutput(os, table, context.c14nSupport, ceh); else - out = new UTF8XmlOutput(os, table, escapeHandler); + out = new UTF8XmlOutput(os, table, ceh); } if(header!=null) out.setHeader(header);