src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/SOAPPartImpl.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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

@@ -243,16 +243,22 @@
                  * Underlying stream must be ByteInputStream for getContentAsStream(). We pay the
                  * cost of copying the underlying bytes here to avoid multiple copies every time
                  * getBytes() is called on a ByteInputStream.
                  */
                 if (!(is instanceof ByteInputStream)) {
-                    ByteOutputStream bout = new ByteOutputStream();
+                    ByteOutputStream bout = null;
+                    try {
+                        bout = new ByteOutputStream();
                     bout.write(is);
 
                     // source.setInputStream(new ByteInputStream(...))
                     FastInfosetReflection.FastInfosetSource_setInputStream(
                         source, bout.newInputStream());
+                    } finally {
+                        if (bout != null)
+                            bout.close();
+                    }
                 }
                 this.source = source;
             }
             else {
                 this.source = source;

@@ -809,6 +815,8 @@
     }
 
     public String getSourceCharsetEncoding() {
         return sourceCharsetEncoding;
     }
+
+    public abstract String getSOAPNamespace();
 }