diff options
author | Dominik Stadler <centic@apache.org> | 2021-04-08 20:10:48 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2021-04-08 20:10:48 +0000 |
commit | 329ae952d27814ebbc6138d32b6b228dc1da4ca9 (patch) | |
tree | 8d1113858e9935e7e5ebccac4cd1ba60a090099c /poi-ooxml | |
parent | b9521e877c0331a5c4f5169b6446569b3b9ba09d (diff) | |
download | poi-329ae952d27814ebbc6138d32b6b228dc1da4ca9.tar.gz poi-329ae952d27814ebbc6138d32b6b228dc1da4ca9.zip |
Ensure the cache-directory for ImageIO is set to a valid directory
Introduce a helper method to set ImageIO.setCacheDir() to the default temporary directory
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1888535 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r-- | poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/dsig/TestSignatureInfo.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/dsig/TestSignatureInfo.java b/poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/dsig/TestSignatureInfo.java index d7fc0b4471..938d8a6622 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/dsig/TestSignatureInfo.java +++ b/poi-ooxml/src/test/java/org/apache/poi/poifs/crypt/dsig/TestSignatureInfo.java @@ -82,6 +82,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.poi.EncryptedDocumentException; import org.apache.poi.POIDataSamples; +import org.apache.poi.POITestCase; import org.apache.poi.ooxml.POIXMLDocument; import org.apache.poi.ooxml.util.DocumentHelper; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; @@ -169,7 +170,12 @@ class TestSignatureInfo { private KeyPair keyPair; private X509Certificate x509; - @AfterAll + @BeforeAll + public static void setUpClass() { + POITestCase.setImageIOCacheDir(); + } + + @AfterAll public static void removeUserLocale() { LocaleUtil.resetUserLocale(); } @@ -922,6 +928,8 @@ class TestSignatureInfo { try (OPCPackage pkg = OPCPackage.open(signDoc, PackageAccess.READ)) { SignatureLine line2 = sup.get(); try (POIXMLDocument doc = reinit.init(line2, pkg)) { + assertNotNull(doc); + line2.parse(); assertEquals(line.getSuggestedSigner(), line2.getSuggestedSigner()); assertEquals(line.getSuggestedSigner2(), line2.getSuggestedSigner2()); @@ -1018,7 +1026,7 @@ class TestSignatureInfo { final String alias = "Test"; final char[] password = "test".toCharArray(); File file = new File("build/test.pfx"); - file.getParentFile().mkdir(); + assertTrue(file.getParentFile().exists() || file.getParentFile().mkdir()); KeyStore keystore = KeyStore.getInstance("PKCS12"); |