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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git


The following commit(s) were added to refs/heads/master by this push:
     new a68b26b2 Use try-with-resources
a68b26b2 is described below

commit a68b26b2e73b7b87a31f5ba70bec970685820194
Author: Gary David Gregory (Code signing key) <ggreg...@apache.org>
AuthorDate: Tue Nov 15 06:50:44 2022 -0500

    Use try-with-resources
    
    Use final
    No need for extra whitespace
---
 src/test/java/org/apache/bcel/OssFuzzTestCase.java | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/test/java/org/apache/bcel/OssFuzzTestCase.java 
b/src/test/java/org/apache/bcel/OssFuzzTestCase.java
index 7f9dbfcf..0df9fc97 100644
--- a/src/test/java/org/apache/bcel/OssFuzzTestCase.java
+++ b/src/test/java/org/apache/bcel/OssFuzzTestCase.java
@@ -32,18 +32,16 @@ public class OssFuzzTestCase {
         testOssFuzzReproducer("51989");
     }
 
-
     @Test
     public void testIssue52168() throws Exception {
         testOssFuzzReproducer("52168");
     }
 
-
-    private void testOssFuzzReproducer(String issue) throws Exception {
-        File reproducerFile = new File("target/test-classes/ossfuzz/issue" + 
issue + "/Test.class");
-        FileInputStream reproducerInputStream = new 
FileInputStream(reproducerFile);
-
-        ClassParser cp = new ClassParser(reproducerInputStream, "Test");
-        assertThrows(ClassFormatException.class, () -> cp.parse());
+    private void testOssFuzzReproducer(final String issue) throws Exception {
+        final File reproducerFile = new 
File("target/test-classes/ossfuzz/issue" + issue + "/Test.class");
+        try (final FileInputStream reproducerInputStream = new 
FileInputStream(reproducerFile)) {
+            final ClassParser cp = new ClassParser(reproducerInputStream, 
"Test");
+            assertThrows(ClassFormatException.class, () -> cp.parse());
+        }
     }
 }

Reply via email to