< prev index next >

jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/streaming/XMLStreamWriterUtil.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2012, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -24,10 +24,11 @@
  */
 
 package com.sun.xml.internal.ws.streaming;
 
 import com.sun.istack.internal.Nullable;
+import com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory;
 import com.sun.xml.internal.ws.encoding.HasEncoding;
 import com.sun.xml.internal.ws.encoding.SOAPBindingCodec;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamWriter;

@@ -55,13 +56,19 @@
      * @throws XMLStreamException if any of writer operations throw the exception
      */
     public static @Nullable OutputStream getOutputStream(XMLStreamWriter writer) throws XMLStreamException {
         Object obj = null;
 
+        XMLStreamWriter xmlStreamWriter =
+                writer instanceof XMLStreamWriterFactory.HasEncodingWriter ?
+                        ((XMLStreamWriterFactory.HasEncodingWriter) writer).getWriter()
+                        : writer;
+
+
         // Hack for JDK6's SJSXP
-        if (writer instanceof Map) {
-            obj = ((Map) writer).get("sjsxp-outputstream");
+        if (xmlStreamWriter instanceof Map) {
+            obj = ((Map) xmlStreamWriter).get("sjsxp-outputstream");
         }
 
         // woodstox
         if (obj == null) {
             try {
< prev index next >