One more try to avoid the test-failures related to ImageIO-cache dir
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1846719 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d1642a89a9
commit
95416d6f05
@ -19,7 +19,6 @@ package org.apache.poi.hssf.usermodel;
|
|||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -28,6 +27,7 @@ import javax.imageio.ImageIO;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||||
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,19 +37,19 @@ import org.junit.BeforeClass;
|
|||||||
* @author Yegor Kozlov (yegor at apache dot org)
|
* @author Yegor Kozlov (yegor at apache dot org)
|
||||||
* @author Trejkaz (trejkaz at trypticon dot org)
|
* @author Trejkaz (trejkaz at trypticon dot org)
|
||||||
*/
|
*/
|
||||||
public final class TestHSSFPictureData extends TestCase{
|
public final class TestHSSFPictureData extends TestCase {
|
||||||
|
private static boolean cacheBefore = ImageIO.getUseCache();
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpClass() {
|
public static void setUpClass() {
|
||||||
// ensure that temp-dir exists because ImageIO requires it
|
// disable cache to avoid strange errors related to temporary directories in CI-builds
|
||||||
String tmpDirProperty = System.getProperty("java.io.tmpdir");
|
ImageIO.setUseCache(false);
|
||||||
if(tmpDirProperty != null) {
|
}
|
||||||
final File tmpDir = new File(tmpDirProperty);
|
|
||||||
if(!tmpDir.exists()) {
|
@AfterClass
|
||||||
if(!tmpDir.mkdirs()) {
|
public static void tearDownClass() {
|
||||||
throw new IllegalStateException("Could not create temporary directory " + tmpDirProperty + ", full path " + tmpDir.getAbsolutePath());
|
// reset image cache to previous state
|
||||||
}
|
ImageIO.setUseCache(cacheBefore);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPictures() throws IOException {
|
public void testPictures() throws IOException {
|
||||||
|
Loading…
Reference in New Issue
Block a user