8160025: compiler/testlibrary/uncommontrap/Verifier doesn't close FileReader
authoriignatyev
Wed, 22 Jun 2016 21:24:07 +0300
changeset 39437 0d59db48adfc
parent 39435 73f5a5e113f8
child 39438 206a712f8f16
8160025: compiler/testlibrary/uncommontrap/Verifier doesn't close FileReader Reviewed-by: kvn
hotspot/test/compiler/testlibrary/uncommontrap/Verifier.java
--- a/hotspot/test/compiler/testlibrary/uncommontrap/Verifier.java	Wed Jun 22 13:29:09 2016 +0300
+++ b/hotspot/test/compiler/testlibrary/uncommontrap/Verifier.java	Wed Jun 22 21:24:07 2016 +0300
@@ -34,6 +34,7 @@
 import java.util.regex.Pattern;
 
 import jdk.test.lib.Asserts;
+
 /**
  * Utility tool aimed to verify presence or absence of specified uncommon trap
  * in compilation log.
@@ -78,7 +79,9 @@
                 PROPERTIES_FILE_SUFFIX);
 
         Properties properties = new Properties();
-        properties.load(new FileReader(propertiesFile.toFile()));
+        try (FileReader reader = new FileReader(propertiesFile.toFile())) {
+            properties.load(reader);
+        }
 
         if (Boolean.valueOf(properties.getProperty(
                 VERIFICATION_SHOULD_BE_SKIPPED, "false"))) {