jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeMultipart.java
changeset 23782 953bfc3fbe31
parent 22679 d785acd84a14
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeMultipart.java	Wed Jul 05 19:34:04 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeMultipart.java	Mon Mar 31 10:43:20 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -318,6 +318,7 @@
         byte[] bndbytes = ASCIIUtility.getBytes(boundary);
         int bl = bndbytes.length;
 
+        ByteOutputStream buf = null;
         try {
             // Skip the preamble
             LineInputStream lin = new LineInputStream(in);
@@ -370,7 +371,7 @@
                 if (!in.markSupported())
                     throw new MessagingException("Stream doesn't support mark");
 
-                ByteOutputStream buf = null;
+                buf = null;
                 // if we don't have a shared input stream, we copy the data
                 if (sin == null)
                     buf = new ByteOutputStream();
@@ -471,6 +472,9 @@
             }
         } catch (IOException ioex) {
             throw new MessagingException("IO Error", ioex);
+        } finally {
+            if (buf != null)
+                buf.close();
         }
 
         if (!ignoreMissingEndBoundary && !foundClosingBoundary && sin== null) {