You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2016/10/09 20:34:35 UTC
svn commit: r1764008 - in /poi/trunk/src:
java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
ooxml/testcases/org/apache/poi/xssf/TestWorkbookProtection.java
Author: kiwiwings
Date: Sun Oct 9 20:34:35 2016
New Revision: 1764008
URL: http://svn.apache.org/viewvc?rev=1764008&view=rev
Log:
Bug 60230 - Roundtrip test that encrypts XSSFWorkbook and then decrypts it fails with latest code
Modified:
poi/trunk/src/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestWorkbookProtection.java
Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java?rev=1764008&r1=1764007&r2=1764008&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java Sun Oct 9 20:34:35 2016
@@ -199,7 +199,7 @@ public abstract class ChunkedCipherInput
System.arraycopy(_plain, 0, _chunk, 0, totalBytes);
- invokeCipher(totalBytes, _chunkSize > -1);
+ invokeCipher(totalBytes, totalBytes == _chunkSize);
}
/**
Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestWorkbookProtection.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestWorkbookProtection.java?rev=1764008&r1=1764007&r2=1764008&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestWorkbookProtection.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestWorkbookProtection.java Sun Oct 9 20:34:35 2016
@@ -189,7 +189,6 @@ public class TestWorkbookProtection {
assertTrue(wb.validateRevisionsPassword("test"));
}
- @Ignore("bug 60230: currently failing due to regression from bug 59857 r1762726")
@Test
public void testEncryptDecrypt() throws Exception {
final String password = "abc123";
@@ -208,7 +207,9 @@ public class TestWorkbookProtection {
EncryptionInfo encryptionInfo = new EncryptionInfo(EncryptionMode.agile);
Encryptor enc = encryptionInfo.getEncryptor();
enc.confirmPassword(password);
- OPCPackage opc = OPCPackage.open(new FileInputStream(tf1));
+ FileInputStream fis = new FileInputStream(tf1);
+ OPCPackage opc = OPCPackage.open(fis);
+ IOUtils.closeQuietly(fis);
try {
OutputStream os = enc.getDataStream(poiFileSystem);
opc.save(os);
@@ -221,7 +222,9 @@ public class TestWorkbookProtection {
poiFileSystem.writeFilesystem(fos2);
IOUtils.closeQuietly(fos2);
workbook.close();
- POIFSFileSystem poiFileSystem2 = new POIFSFileSystem(new FileInputStream(tf1));
+ fis = new FileInputStream(tf1);
+ POIFSFileSystem poiFileSystem2 = new POIFSFileSystem(fis);
+ IOUtils.closeQuietly(fis);
EncryptionInfo encryptionInfo2 = new EncryptionInfo(poiFileSystem2);
Decryptor decryptor = encryptionInfo2.getDecryptor();
decryptor.verifyPassword(password);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org