< prev index next >

test/java/nio/file/Files/probeContentType/ParallelProbes.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -29,10 +29,11 @@
  */
 
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 
 public class ParallelProbes {
 
     private static final int REPEATS = 1000;

@@ -45,11 +46,12 @@
         this.numThreads = numThreads;
         this.threads = new ArrayList<Thread>(numThreads);
     }
 
     private Path createTmpFile() throws IOException {
-        final Path p = Files.createTempFile("prefix", ".json");
+        Path dir = Paths.get(System.getProperty("test.dir", "."));
+        final Path p = Files.createTempFile(dir, "prefix", ".json");
         Files.write(p, "{\"test\"}".getBytes());
         System.out.println("Write test file <" + p + ">");
         return p;
     }
 
< prev index next >