8154500: fix handling of jdk.launcher.patch.* in tests
authorjjg
Mon, 18 Apr 2016 19:14:50 -0700
changeset 37637 b47af0433922
parent 37636 6c6e6e25189d
child 37638 aac00923d48e
8154500: fix handling of jdk.launcher.patch.* in tests Reviewed-by: ksrini
langtools/test/jdk/javadoc/tool/6964914/TestStdDoclet.java
langtools/test/jdk/javadoc/tool/6964914/TestUserDoclet.java
langtools/test/tools/javadoc/6964914/TestStdDoclet.java
langtools/test/tools/javadoc/6964914/TestUserDoclet.java
--- a/langtools/test/jdk/javadoc/tool/6964914/TestStdDoclet.java	Mon Apr 18 18:41:38 2016 -0700
+++ b/langtools/test/jdk/javadoc/tool/6964914/TestStdDoclet.java	Mon Apr 18 19:14:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, 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
@@ -28,6 +28,7 @@
  */
 
 import java.io.*;
+import java.util.*;
 
 /**
  * Dummy javadoc comment.
@@ -54,13 +55,21 @@
         // run javadoc in separate process to ensure doclet executed under
         // normal user conditions w.r.t. classloader
         String thisClassName = TestStdDoclet.class.getName();
-        Process p = new ProcessBuilder()
-            .command(javadoc.getPath(),
-                "-J-Xpatch:" + System.getProperty("jdk.launcher.patch.0", ""),
+        List<String> cmdArgs = new ArrayList<>();
+        cmdArgs.add(javadoc.getPath());
+        int i = 0;
+        String prop;
+        while ((prop = System.getProperty("jdk.launcher.patch." + (i++))) != null) {
+            cmdArgs.add("-J-Xpatch:" + prop);
+        }
+        cmdArgs.addAll(Arrays.asList(
                 "-classpath", ".", // insulates us from ambient classpath
                 "-Xdoclint:none",
                 "-package",
-                new File(testSrc, thisClassName + ".java").getPath())
+                new File(testSrc, thisClassName + ".java").getPath()
+        ));
+        Process p = new ProcessBuilder()
+            .command(cmdArgs)
             .redirectErrorStream(true)
             .start();
 
--- a/langtools/test/jdk/javadoc/tool/6964914/TestUserDoclet.java	Mon Apr 18 18:41:38 2016 -0700
+++ b/langtools/test/jdk/javadoc/tool/6964914/TestUserDoclet.java	Mon Apr 18 19:14:50 2016 -0700
@@ -30,7 +30,10 @@
 
 import java.io.*;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
+import java.util.List;
 import java.util.Locale;
 import java.util.Set;
 
@@ -63,12 +66,20 @@
         // run javadoc in separate process to ensure doclet executed under
         // normal user conditions w.r.t. classloader
         String thisClassName = TestUserDoclet.class.getName();
-        Process p = new ProcessBuilder()
-            .command(javadoc.getPath(),
-                "-J-Xpatch:" + System.getProperty("jdk.launcher.patch.0", ""),
+        List<String> cmdArgs = new ArrayList<>();
+        cmdArgs.add(javadoc.getPath());
+        int i = 0;
+        String prop;
+        while ((prop = System.getProperty("jdk.launcher.patch." + (i++))) != null) {
+            cmdArgs.add("-J-Xpatch:" + prop);
+        }
+        cmdArgs.addAll(Arrays.asList(
                 "-doclet", thisClassName,
                 "-docletpath", testClasses.getPath(),
-                new File(testSrc, thisClassName + ".java").getPath())
+                new File(testSrc, thisClassName + ".java").getPath()
+        ));
+        Process p = new ProcessBuilder()
+            .command(cmdArgs)
             .redirectErrorStream(true)
             .start();
 
--- a/langtools/test/tools/javadoc/6964914/TestStdDoclet.java	Mon Apr 18 18:41:38 2016 -0700
+++ b/langtools/test/tools/javadoc/6964914/TestStdDoclet.java	Mon Apr 18 19:14:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, 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
@@ -28,6 +28,7 @@
  */
 
 import java.io.*;
+import java.util.*;
 
 /**
  * Dummy javadoc comment.
@@ -54,13 +55,21 @@
         // run javadoc in separate process to ensure doclet executed under
         // normal user conditions w.r.t. classloader
         String thisClassName = TestStdDoclet.class.getName();
-        Process p = new ProcessBuilder()
-            .command(javadoc.getPath(),
-                "-J-Xpatch:" + System.getProperty("jdk.launcher.patch.0", ""),
+        List<String> cmdArgs = new ArrayList<>();
+        cmdArgs.add(javadoc.getPath());
+        int i = 0;
+        String prop;
+        while ((prop = System.getProperty("jdk.launcher.patch." + (i++))) != null) {
+            cmdArgs.add("-J-Xpatch:" + prop);
+        }
+        cmdArgs.addAll(Arrays.asList(
                 "-classpath", ".", // insulates us from ambient classpath
                 "-Xdoclint:none",
                 "-package",
-                new File(testSrc, thisClassName + ".java").getPath())
+                new File(testSrc, thisClassName + ".java").getPath()
+        ));
+        Process p = new ProcessBuilder()
+            .command(cmdArgs)
             .redirectErrorStream(true)
             .start();
 
--- a/langtools/test/tools/javadoc/6964914/TestUserDoclet.java	Mon Apr 18 18:41:38 2016 -0700
+++ b/langtools/test/tools/javadoc/6964914/TestUserDoclet.java	Mon Apr 18 19:14:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, 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
@@ -29,6 +29,8 @@
  */
 
 import java.io.*;
+import java.util.*;
+
 import com.sun.javadoc.Doclet;
 import com.sun.javadoc.RootDoc;
 
@@ -55,12 +57,20 @@
         // run javadoc in separate process to ensure doclet executed under
         // normal user conditions w.r.t. classloader
         String thisClassName = TestUserDoclet.class.getName();
-        Process p = new ProcessBuilder()
-            .command(javadoc.getPath(),
-                "-J-Xpatch:" + System.getProperty("jdk.launcher.patch.0", ""),
+        List<String> cmdArgs = new ArrayList<>();
+        cmdArgs.add(javadoc.getPath());
+        int i = 0;
+        String prop;
+        while ((prop = System.getProperty("jdk.launcher.patch." + (i++))) != null) {
+            cmdArgs.add("-J-Xpatch:" + prop);
+        }
+        cmdArgs.addAll(Arrays.asList(
                 "-doclet", thisClassName,
                 "-docletpath", testClasses.getPath(),
-                new File(testSrc, thisClassName + ".java").getPath())
+                new File(testSrc, thisClassName + ".java").getPath()
+        ));
+        Process p = new ProcessBuilder()
+            .command(cmdArgs)
             .redirectErrorStream(true)
             .start();