8190814: javax/imageio/stream/NullStreamCheckTest writes to the repo
authormartin
Tue, 07 Nov 2017 10:35:58 -0800
changeset 47711 c992889ffb50
parent 47710 6b0c555658e8
child 47712 bde0215f1f70
8190814: javax/imageio/stream/NullStreamCheckTest writes to the repo Reviewed-by: pnarayanan, jdv, prr
test/jdk/javax/imageio/stream/NullStreamCheckTest.java
--- a/test/jdk/javax/imageio/stream/NullStreamCheckTest.java	Tue Nov 07 10:02:48 2017 -0800
+++ b/test/jdk/javax/imageio/stream/NullStreamCheckTest.java	Tue Nov 07 10:35:58 2017 -0800
@@ -58,17 +58,6 @@
     static BufferedImage inputImage = new BufferedImage(width, height,
             BufferedImage.TYPE_INT_ARGB);
 
-    // creates test file needed for read and write in local directory.
-    private static File createTestFile(String name) throws IOException {
-        String sep = System.getProperty("file.separator");
-        String dir = System.getProperty("test.src", ".");
-        String filePath = dir+sep;
-        File directory = new File(filePath);
-        File tmpTestFile = File.createTempFile(name, ".png", directory);
-        directory.delete();
-        return tmpTestFile;
-    }
-
     /* if we catch expected IOException message return
      * false otherwise return true.
      */
@@ -86,7 +75,7 @@
     }
 
     private static void verifyFileWrite() throws IOException {
-        File outputTestFile = createTestFile("outputTestFile");
+        File outputTestFile = File.createTempFile("outputTestFile", ".png");
         try {
             ImageIO.write(inputImage, "png", outputTestFile);
         } catch (IOException ex) {
@@ -113,7 +102,7 @@
     }
 
     private static void verifyFileRead() throws IOException {
-        File inputTestFile = createTestFile("inputTestFile");
+        File inputTestFile = File.createTempFile("inputTestFile", ".png");
         try {
             ImageIO.read(inputTestFile);
         } catch (IOException ex) {
@@ -141,7 +130,7 @@
 
     private static void verifyUrlRead() throws IOException {
         URL url;
-        File inputTestUrlFile = createTestFile("inputTestFile");
+        File inputTestUrlFile = File.createTempFile("inputTestFile", ".png");
         try {
             try {
                 url = inputTestUrlFile.toURI().toURL();