1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/message/jaxb/JAXBHeader.java Thu Aug 08 10:10:38 2013 -0700 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/message/jaxb/JAXBHeader.java Fri Aug 23 09:57:21 2013 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -28,6 +28,7 @@ 1.11 import com.sun.istack.internal.NotNull; 1.12 import com.sun.istack.internal.XMLStreamException2; 1.13 import com.sun.xml.internal.bind.api.Bridge; 1.14 +import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer; 1.15 import com.sun.xml.internal.stream.buffer.XMLStreamBuffer; 1.16 import com.sun.xml.internal.stream.buffer.XMLStreamBufferResult; 1.17 import com.sun.xml.internal.ws.api.message.Header; 1.18 @@ -142,16 +143,12 @@ 1.19 } 1.20 1.21 public XMLStreamReader readHeader() throws XMLStreamException { 1.22 - try { 1.23 - if(infoset==null) { 1.24 - XMLStreamBufferResult sbr = new XMLStreamBufferResult(); 1.25 - bridge.marshal(jaxbObject,sbr); 1.26 - infoset = sbr.getXMLStreamBuffer(); 1.27 - } 1.28 - return infoset.readAsXMLStreamReader(); 1.29 - } catch (JAXBException e) { 1.30 - throw new XMLStreamException2(e); 1.31 + if(infoset==null) { 1.32 + MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer(); 1.33 + writeTo(buffer.createFromXMLStreamWriter()); 1.34 + infoset = buffer; 1.35 } 1.36 + return infoset.readAsXMLStreamReader(); 1.37 } 1.38 1.39 public <T> T readAsJAXB(Unmarshaller unmarshaller) throws JAXBException {