Ensure that the tempdir exists when we use ImageIO in one of the tests

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1816046 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2017-11-22 12:25:11 +00:00
parent e22d67682f
commit d6f97af799

View File

@ -19,6 +19,7 @@ package org.apache.poi.hwpf;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.util.List;
import javax.imageio.ImageIO;
@ -57,6 +58,11 @@ public final class TestHWPFPictures extends TestCase {
imgBFile = "simple_image.png";
imgCFile = "vector_image.emf";
imgDFile = "GaiaTestImg.png";
// we use ImageIO in one of the tests here so we should ensure that the temporary directory is created correctly
File tempDir = new File(System.getProperty("java.io.tmpdir"));
assertTrue("Could not create temporary directory " + tempDir.getAbsolutePath() + ": " + tempDir.exists() + "/" + tempDir.isDirectory(),
tempDir.exists() || tempDir.mkdirs());
}
/**