< prev index next >

test/jdk/java/net/httpclient/security/Driver.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2015, 2024, 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.

@@ -54,10 +54,11 @@
  import java.nio.file.Paths;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.stream.Collectors;
  import jdk.test.lib.Utils;
+ import jdk.test.lib.process.ProcessTools;
  
  /**
   * Driver for tests
   */
  public class Driver {

@@ -124,16 +125,14 @@
          String testJdk = System.getProperty("test.jdk", "?");
          String testSrc = System.getProperty("test.src", "?");
          String testClassPath = System.getProperty("test.class.path", "?");
          String testClasses = System.getProperty("test.classes", "?");
          String sep = System.getProperty("file.separator", "?");
-         String javaCmd = testJdk + sep + "bin" + sep + "java";
          int retval = 10; // 10 is special exit code denoting a bind error
                           // in which case, we retry
          while (retval == 10) {
              List<String> cmd = new ArrayList<>();
-             cmd.add(javaCmd);
              cmd.add("-ea");
              cmd.add("-esa");
              cmd.add("-Dtest.jdk=" + testJdk);
              cmd.add("-Dtest.src=" + testSrc);
              cmd.add("-Dtest.classes=" + testClasses);

@@ -148,11 +147,11 @@
              cmd.add("-cp");
              cmd.add(testClassPath);
              cmd.add("Security");
              cmd.add(testnum);
  
-             ProcessBuilder processBuilder = new ProcessBuilder(cmd)
+             ProcessBuilder processBuilder = ProcessTools.createTestJavaProcessBuilder(cmd)
                  .redirectOutput(ProcessBuilder.Redirect.PIPE)
                  .redirectErrorStream(true);
  
              String cmdLine = cmd.stream().collect(Collectors.joining(" "));
              long start = System.currentTimeMillis();
< prev index next >