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


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

commit 8e31a740b7cb6ee80a5253198dc24795557329b4
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Dec 9 18:59:01 2022 -0500

    Use try-with-resources
---
 .../commons/crypto/stream/AbstractCipherStreamTest.java      | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/crypto/stream/AbstractCipherStreamTest.java 
b/src/test/java/org/apache/commons/crypto/stream/AbstractCipherStreamTest.java
index c7018bb..2813f77 100644
--- 
a/src/test/java/org/apache/commons/crypto/stream/AbstractCipherStreamTest.java
+++ 
b/src/test/java/org/apache/commons/crypto/stream/AbstractCipherStreamTest.java
@@ -436,12 +436,12 @@ public abstract class AbstractCipherStreamTest {
         assertEquals(in.getParams().getClass(), IvParameterSpec.class);
         assertNotNull(in.getInput());
 
-        final CryptoOutputStream out = newCryptoOutputStream(baos, 
getCipher(cipherClass),
-                defaultBufferSize, iv, withChannel);
-
-        assertEquals(out.getOutBuffer().capacity(), defaultBufferSize + 
cipher.getBlockSize());
-        assertEquals(out.getInBuffer().capacity(), defaultBufferSize);
-        assertEquals(out.getBufferSize(), defaultBufferSize);
+        try (final CryptoOutputStream out = newCryptoOutputStream(baos, 
getCipher(cipherClass),
+                defaultBufferSize, iv, withChannel)) {
+            assertEquals(out.getOutBuffer().capacity(), defaultBufferSize + 
cipher.getBlockSize());
+            assertEquals(out.getInBuffer().capacity(), defaultBufferSize);
+            assertEquals(out.getBufferSize(), defaultBufferSize);
+        }
     }
 
     private void byteBufferReadCheck(final InputStream in, final ByteBuffer 
buf, final int bufPos)

Reply via email to