Skip to content

Commit

Permalink
Improved: Use try with resources in ‘readXmlDocument’
Browse files Browse the repository at this point in the history
(OFBIZ-8202)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1862320 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Jun 29, 2019
1 parent 4d7e598 commit c5ea5d8
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -387,10 +387,9 @@ public static Document readXmlDocument(URL url, boolean validate)
Debug.logWarning("[UtilXml.readXmlDocument] URL was null, doing nothing", module); Debug.logWarning("[UtilXml.readXmlDocument] URL was null, doing nothing", module);
return null; return null;
} }
InputStream is = url.openStream(); try (InputStream is = url.openStream()) {
Document document = readXmlDocument(is, validate, url.toString()); return readXmlDocument(is, validate, url.toString());
is.close(); }
return document;
} }


public static Document readXmlDocument(URL url, boolean validate, boolean withPosition) public static Document readXmlDocument(URL url, boolean validate, boolean withPosition)
Expand Down

0 comments on commit c5ea5d8

Please sign in to comment.