File tree Expand file tree Collapse file tree
src/main/java/loci/common/xml Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -189,12 +189,9 @@ public static Document createDocument() {
189189 public static Document parseDOM (File file )
190190 throws ParserConfigurationException , SAXException , IOException
191191 {
192- InputStream is = new FileInputStream (file );
193- try {
192+ try (InputStream is = new FileInputStream (file )) {
194193 Document doc = parseDOM (is );
195194 return doc ;
196- } finally {
197- is .close ();
198195 }
199196 }
200197
@@ -211,12 +208,9 @@ public static Document parseDOM(String xml)
211208 throws ParserConfigurationException , SAXException , IOException
212209 {
213210 byte [] bytes = xml .getBytes (Constants .ENCODING );
214- InputStream is = new ByteArrayInputStream (bytes );
215- try {
211+ try (InputStream is = new ByteArrayInputStream (bytes )) {
216212 Document doc = parseDOM (is );
217213 return doc ;
218- } finally {
219- is .close ();
220214 }
221215 }
222216
You can’t perform that action at this time.
0 commit comments