< prev index next >

test/jdk/java/net/URLConnection/ContentHandlers/ContentHandlersTest.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2015, 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.
--- 1,7 ---
  /*
!  * 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.

*** 19,10 ***
--- 19,12 ---
   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   */
  
+ import jdk.test.lib.process.ProcessTools;
+ 
  import java.io.BufferedReader;
  import java.io.BufferedWriter;
  import java.io.File;
  import java.io.FileReader;
  import java.io.FileWriter;

*** 54,10 ***
--- 56,11 ---
  import static java.util.Collections.singletonMap;
  
  /*
   * @test
   * @bug 8064925
+  * @library /test/lib
   * @summary Basic test for ContentHandler. Ensures discovery paths for content
   *          handlers follow a particular order.
   */
  public class ContentHandlersTest {
  

*** 266,28 ***
  
      private static Result java(Map<String, String> properties,
                                 Collection<Path> classpath,
                                 String classname, String... args) {
  
!         String java = getJDKTool("java");
- 
-         List<String> commands = new ArrayList<>();
-         commands.add(java);
-         commands.addAll(properties.entrySet()
                  .stream()
                  .map(e -> "-D" + e.getKey() + "=" + e.getValue())
!                 .collect(Collectors.toList()));
  
          String cp = classpath.stream()
                  .map(Path::toString)
                  .collect(Collectors.joining(File.pathSeparator));
          commands.add("-cp");
          commands.add(cp);
          commands.add(classname);
          commands.addAll(Arrays.asList(args));
  
!         return run(new ProcessBuilder(commands));
      }
  
      private static Result run(ProcessBuilder b) {
          Process p;
          try {
--- 269,24 ---
  
      private static Result java(Map<String, String> properties,
                                 Collection<Path> classpath,
                                 String classname, String... args) {
  
!         List<String> commands = properties.entrySet()
                  .stream()
                  .map(e -> "-D" + e.getKey() + "=" + e.getValue())
!                 .collect(Collectors.toList());
  
          String cp = classpath.stream()
                  .map(Path::toString)
                  .collect(Collectors.joining(File.pathSeparator));
          commands.add("-cp");
          commands.add(cp);
          commands.add(classname);
          commands.addAll(Arrays.asList(args));
  
!         return run(ProcessTools.createTestJavaProcessBuilder(commands));
      }
  
      private static Result run(ProcessBuilder b) {
          Process p;
          try {
< prev index next >