Skip to content

Commit 5eb1ed6

Browse files
committed
PDFBOX-5660: close input, as suggested by Valery Bokov; closes #344
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1929857 13f79535-47bb-0310-9956-ffa450edef68
1 parent 2ef672d commit 5eb1ed6

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ void testPDFBox5955() throws IOException
292292
* @throws IOException If there is an unexpected error during the test.
293293
*/
294294
@Test
295-
void testProtectionInnerAttachment() throws IOException
295+
void testProtectionInnerAttachmetn() throws IOException
296296
{
297297
String testFileName = "preEnc_20141025_105451.pdf";
298298
byte[] inputFileWithEmbeddedFileAsByteArray = getFileResourceAsByteArray(testFileName);
@@ -535,7 +535,10 @@ private void testSymmEncrForKeySizeInner(int keyLength, boolean preferAES,
535535

536536
private byte[] getFileResourceAsByteArray(String testFileName) throws IOException
537537
{
538-
return TestSymmetricKeyEncryption.class.getResourceAsStream(testFileName).readAllBytes();
538+
try (InputStream is = TestSymmetricKeyEncryption.class.getResourceAsStream(testFileName))
539+
{
540+
return is.readAllBytes();
541+
}
539542
}
540543

541544
private byte[] getFileAsByteArray(File f) throws IOException

0 commit comments

Comments
 (0)