< prev index next >

test/jtreg-ext/requires/VMProps.java

Print this page
rev 2327 : 8170228: register closed @requires property setter
Reviewed-by:

@@ -23,10 +23,11 @@
 package requires;
 
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Callable;

@@ -60,11 +61,11 @@
         map.put("vm.flightRecorder", vmFlightRecorder());
         map.put("vm.simpleArch", vmArch());
         map.put("vm.debug", vmDebug());
         vmGC(map); // vm.gc.X = true/false
 
-        dump(map);
+        VMProps.dump(map);
         return map;
     }
 
     /**
      * @return vm.simpleArch value of "os.simpleArch" property of tested JDK.

@@ -178,19 +179,19 @@
      * This functionality could be helpful to know context in the real
      * execution.
      *
      * @param map
      */
-    protected void dump(Map<String, String> map) {
+    protected static void dump(Map<String, String> map) {
         String dumpFileName = System.getProperty("vmprops.dump");
         if (dumpFileName == null) {
             return;
         }
         List<String> lines = new ArrayList<>();
         map.forEach((k, v) -> lines.add(k + ":" + v));
         try {
-            Files.write(Paths.get(dumpFileName), lines);
+            Files.write(Paths.get(dumpFileName), lines, StandardOpenOption.APPEND);
         } catch (IOException e) {
             throw new RuntimeException("Failed to dump properties into '"
                     + dumpFileName + "'", e);
         }
     }
< prev index next >