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 00:41:22 UTC

[cxf] branch master updated: Fixing yet another InputStream leak

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

reta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 0cc2c5a  Fixing yet another InputStream leak
0cc2c5a is described below

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

    Fixing yet another InputStream leak
---
 .../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);
             }