You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ta...@apache.org on 2017/03/21 00:03:01 UTC

svn commit: r1787890 - /poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSecureTempZip.java

Author: tallison
Date: Tue Mar 21 00:03:01 2017
New Revision: 1787890

URL: http://svn.apache.org/viewvc?rev=1787890&view=rev
Log:
60881 -- fix new unit test.  xlsb test file apparently requires unlimited jce.  If not installed, ignore new test.

Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSecureTempZip.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSecureTempZip.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSecureTempZip.java?rev=1787890&r1=1787889&r2=1787890&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSecureTempZip.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSecureTempZip.java Tue Mar 21 00:03:01 2017
@@ -20,6 +20,7 @@ package org.apache.poi.poifs.crypt;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
+import javax.crypto.Cipher;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -39,6 +40,10 @@ import org.apache.xmlbeans.XmlException;
 import org.junit.Test;
 
 public class TestSecureTempZip {
+
+    static {
+        System.setProperty("POI.testdata.path", "C:/users/tallison/idea projects/poi-trunk/test-data");
+    }
     /**
      * Test case for #59841 - this is an example on how to use encrypted temp files,
      * which are streamed into POI opposed to having everything in memory
@@ -82,11 +87,16 @@ public class TestSecureTempZip {
     }
 
     /**
-     * Test case for #59841 - this is an example on how to use encrypted temp files,
-     * which are streamed into POI opposed to having everything in memory
+     * Now try with xlsb.
      */
     @Test
     public void protectedXLSBZip() throws IOException, GeneralSecurityException, XmlException, OpenXML4JException {
+        //The test file requires that JCE unlimited be installed.
+        //If it isn't installed, skip this test.
+        int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES");
+        if (maxKeyLen <= 128) {
+            return;
+        }
         File tikaProt = XSSFTestDataSamples.getSampleFile("protected_passtika.xlsb");
         FileInputStream fis = new FileInputStream(tikaProt);
         POIFSFileSystem poifs = new POIFSFileSystem(fis);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org