From 217a7caae6dcb0b02debe3a187d637f155f9ae65 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Mon, 20 May 2019 17:35:54 +0000 Subject: [PATCH] Use TempFile to avoid problems with temporary directories in Maven builds git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1859575 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/poifs/filesystem/TestFileMagic.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestFileMagic.java b/src/testcases/org/apache/poi/poifs/filesystem/TestFileMagic.java index 600a316796..3022abe6fd 100644 --- a/src/testcases/org/apache/poi/poifs/filesystem/TestFileMagic.java +++ b/src/testcases/org/apache/poi/poifs/filesystem/TestFileMagic.java @@ -19,6 +19,7 @@ package org.apache.poi.poifs.filesystem; import org.apache.commons.codec.Charsets; import org.apache.poi.POIDataSamples; +import org.apache.poi.util.TempFile; import org.junit.Test; import java.io.BufferedInputStream; @@ -108,7 +109,7 @@ public class TestFileMagic { // having a file shorter than 8 bytes previously caused an exception byte[] data = new byte[] { -1, -40, -1, -32, 0 }; - File file = File.createTempFile("TestFileMagic", ".bin"); + File file = TempFile.createTempFile("TestFileMagic", ".bin"); try { try (FileOutputStream fos = new FileOutputStream(file)) { fos.write(data); @@ -124,7 +125,7 @@ public class TestFileMagic { public void testMarkRequired() throws IOException { byte[] data = new byte[] { -1, -40, -1, -32, 0 }; - File file = File.createTempFile("TestFileMagic", ".bin"); + File file = TempFile.createTempFile("TestFileMagic", ".bin"); try { try (FileOutputStream fos = new FileOutputStream(file)) { fos.write(data);