svn commit: r1862320 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1862320 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java

mthl
Author: mthl
Date: Sat Jun 29 18:08:20 2019
New Revision: 1862320

URL: http://svn.apache.org/viewvc?rev=1862320&view=rev
Log:
Improved: Use try with resources in ‘readXmlDocument’
(OFBIZ-8202)

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java?rev=1862320&r1=1862319&r2=1862320&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java Sat Jun 29 18:08:20 2019
@@ -387,10 +387,9 @@ public final class UtilXml {
             Debug.logWarning("[UtilXml.readXmlDocument] URL was null, doing nothing", module);
             return null;
         }
-        InputStream is = url.openStream();
-        Document document = readXmlDocument(is, validate, url.toString());
-        is.close();
-        return document;
+        try (InputStream is = url.openStream()) {
+            return readXmlDocument(is, validate, url.toString());
+        }
     }
 
     public static Document readXmlDocument(URL url, boolean validate, boolean withPosition)