--- old/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/JAXMStreamSource.java 2014-03-28 17:28:31.000000000 +0100 +++ new/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/JAXMStreamSource.java 2014-03-28 17:28:31.000000000 +0100 @@ -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 @@ -47,9 +47,15 @@ } else if (is instanceof ByteInputStream) { this.in = (ByteInputStream) is; } else { - ByteOutputStream bout = new ByteOutputStream(); - bout.write(is); - this.in = bout.newInputStream(); + ByteOutputStream bout = null; + try { + bout = new ByteOutputStream(); + bout.write(is); + this.in = bout.newInputStream(); + } finally { + if (bout != null) + bout.close(); + } } }