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-compress.git


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

commit 9e71500964c3e35aeadedfb28875e46403913ebb
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Fri May 17 10:22:46 2024 -0400

    Use try-with-resources
---
 .../apache/commons/compress/harmony/pack200/ArchiveTest.java   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/compress/harmony/pack200/ArchiveTest.java 
b/src/test/java/org/apache/commons/compress/harmony/pack200/ArchiveTest.java
index 167cf819c..fb71c4709 100755
--- a/src/test/java/org/apache/commons/compress/harmony/pack200/ArchiveTest.java
+++ b/src/test/java/org/apache/commons/compress/harmony/pack200/ArchiveTest.java
@@ -199,11 +199,11 @@ public class ArchiveTest extends AbstractTempDirTest {
     public void testJNDI() throws IOException, Pack200Exception, 
URISyntaxException {
         final File file = createTempFile("jndi", ".pack");
         try (JarFile in = new JarFile(new 
File(Archive.class.getResource("/pack200/jndi.jar").toURI()))) {
-            final FileOutputStream out = new FileOutputStream(file);
-            final PackingOptions options = new PackingOptions();
-            options.setGzip(false);
-            new Archive(in, out, options).pack();
-            out.close();
+            try (FileOutputStream out = new FileOutputStream(file)) {
+                final PackingOptions options = new PackingOptions();
+                options.setGzip(false);
+                new Archive(in, out, options).pack();
+            }
         }
 
         // now unpack

Reply via email to