Repository: cxf Updated Branches: refs/heads/3.0.x-fixes bbe8829c6 -> 2eff02422
[CXF-7155] Close CachedOutputStream when response is written to the output stream, patch from Alexander Onnikov applied, This closes #207 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2eff0242 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2eff0242 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2eff0242 Branch: refs/heads/3.0.x-fixes Commit: 2eff02422ab7d9fd336f44944f624ec35adec18d Parents: bbe8829 Author: Sergey Beryozkin <[email protected]> Authored: Sun Nov 27 18:43:26 2016 +0000 Committer: Sergey Beryozkin <[email protected]> Committed: Sun Nov 27 18:47:09 2016 +0000 ---------------------------------------------------------------------- .../org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/2eff0242/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java index 5eba218..ce8c4fd 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java @@ -255,6 +255,10 @@ public class JAXRSOutInterceptor extends AbstractOutDatabindingInterceptor { checkCachedStream(message, outOriginal, enabled); } finally { if (enabled) { + OutputStream os = message.getContent(OutputStream.class); + if (os != outOriginal && os instanceof CachedOutputStream) { + os.close(); + } message.setContent(OutputStream.class, outOriginal); message.put(XMLStreamWriter.class.getName(), null); }
