You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2021/02/17 01:16:23 UTC

[cxf] branch 3.4.x-fixes updated: Fixing yet another InputStream leak

This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.4.x-fixes by this push:
     new 78c80c2  Fixing yet another InputStream leak
78c80c2 is described below

commit 78c80c2e5b893d7ec1625811ac521fe49549579f
Author: reta <dr...@gmail.com>
AuthorDate: Tue Feb 16 19:40:16 2021 -0500

    Fixing yet another InputStream leak
    
    (cherry picked from commit 0cc2c5ab71cb033ed72befe74a8261220a50d824)
---
 .../org/apache/cxf/service/factory/AbstractServiceFactoryBean.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java b/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
index 8edc53e..b72c4e2 100644
--- a/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
+++ b/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.service.factory;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -143,8 +144,8 @@ public abstract class AbstractServiceFactoryBean {
                 }
             }
             Document d;
-            try {
-                d = StaxUtils.read(url.openStream());
+            try (InputStream in = url.openStream()) {
+                d = StaxUtils.read(in);
             } catch (Exception e) {
                 throw new ServiceConstructionException(new Message("ERROR_READING_SCHEMA", LOG, l), e);
             }