You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/08/29 14:45:18 UTC
[commons-compress] 05/06: Add @SuppressWarnings
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
commit b0c57d26065d377138d6e70b811ab21adfefb0cf
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Aug 29 10:12:51 2023 -0400
Add @SuppressWarnings
---
.../compress/archivers/examples/ExpanderTest.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java b/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
index 181647ee..ed31b911 100644
--- a/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
@@ -125,8 +125,8 @@ public class ExpanderTest extends AbstractTestCase {
try (OutputStream o = Files.newOutputStream(dummy.toPath())) {
o.write(new byte[14]);
}
- try (ArchiveOutputStream aos = ArchiveStreamFactory.DEFAULT
- .createArchiveOutputStream("tar", Files.newOutputStream(archive.toPath()))) {
+ try (@SuppressWarnings("resource") // Files.newOutputStream result closed by ArchiveOutputStream
+ ArchiveOutputStream aos = ArchiveStreamFactory.DEFAULT.createArchiveOutputStream("tar", Files.newOutputStream(archive.toPath()))) {
aos.putArchiveEntry(aos.createArchiveEntry(dir, "a"));
aos.closeArchiveEntry();
aos.putArchiveEntry(aos.createArchiveEntry(dir, "a/b"));
@@ -149,8 +149,8 @@ public class ExpanderTest extends AbstractTestCase {
try (OutputStream o = Files.newOutputStream(dummy.toPath())) {
o.write(new byte[14]);
}
- try (ArchiveOutputStream aos = ArchiveStreamFactory.DEFAULT
- .createArchiveOutputStream("tar", Files.newOutputStream(archive.toPath()))) {
+ try (@SuppressWarnings("resource") // Files.newOutputStream result closed by ArchiveOutputStream
+ ArchiveOutputStream aos = ArchiveStreamFactory.DEFAULT.createArchiveOutputStream("tar", Files.newOutputStream(archive.toPath()))) {
aos.putArchiveEntry(aos.createArchiveEntry(dir, "./"));
aos.closeArchiveEntry();
aos.putArchiveEntry(aos.createArchiveEntry(dir, "./a"));
@@ -175,8 +175,8 @@ public class ExpanderTest extends AbstractTestCase {
try (OutputStream o = Files.newOutputStream(dummy.toPath())) {
o.write(new byte[14]);
}
- try (ArchiveOutputStream aos = ArchiveStreamFactory.DEFAULT
- .createArchiveOutputStream("zip", Files.newOutputStream(archive.toPath()))) {
+ try (@SuppressWarnings("resource") // // Files.newOutputStream result closed by ArchiveOutputStream
+ ArchiveOutputStream aos = ArchiveStreamFactory.DEFAULT.createArchiveOutputStream("zip", Files.newOutputStream(archive.toPath()))) {
aos.putArchiveEntry(aos.createArchiveEntry(dir, "a"));
aos.closeArchiveEntry();
aos.putArchiveEntry(aos.createArchiveEntry(dir, "a/b"));
@@ -199,8 +199,8 @@ public class ExpanderTest extends AbstractTestCase {
try (OutputStream o = Files.newOutputStream(dummy.toPath())) {
o.write(new byte[14]);
}
- try (ArchiveOutputStream aos = ArchiveStreamFactory.DEFAULT
- .createArchiveOutputStream("zip", Files.newOutputStream(archive.toPath()))) {
+ try (@SuppressWarnings("resource") // Files.newOutputStream result closed by ArchiveOutputStream
+ ArchiveOutputStream aos = ArchiveStreamFactory.DEFAULT.createArchiveOutputStream("zip", Files.newOutputStream(archive.toPath()))) {
aos.putArchiveEntry(aos.createArchiveEntry(dummy, entry));
aos.write("Hello, world 1".getBytes(UTF_8));
aos.closeArchiveEntry();