< prev index next >

test/jdk/java/net/spi/URLStreamHandlerProvider/Basic.java

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

*** 43,10 ***
--- 43,12 ---
  import javax.tools.JavaCompiler;
  import javax.tools.JavaFileObject;
  import javax.tools.StandardJavaFileManager;
  import javax.tools.StandardLocation;
  import javax.tools.ToolProvider;
+ 
+ import jdk.test.lib.process.ProcessTools;
  import jdk.test.lib.util.FileUtils;
  import jdk.test.lib.JDKToolFinder;
  import static java.lang.String.format;
  import static java.util.Arrays.asList;
  

*** 232,26 ***
              throw new RuntimeException(r.output);
      }
  
      static Result java(List<String> sysProps, Collection<Path> classpath,
                         String classname, String arg) {
-         String java = getJDKTool("java");
  
!         List<String> commands = new ArrayList<>();
-         commands.add(java);
-         for (String prop : sysProps)
-             commands.add(prop);
  
          String cp = classpath.stream()
                  .map(Path::toString)
                  .collect(Collectors.joining(File.pathSeparator));
          commands.add("-cp");
          commands.add(cp);
          commands.add(classname);
          commands.add(arg);
  
!         return run(new ProcessBuilder(commands));
      }
  
      static Result run(ProcessBuilder pb) {
          Process p = null;
          System.out.println("running: " + pb.command());
--- 234,22 ---
              throw new RuntimeException(r.output);
      }
  
      static Result java(List<String> sysProps, Collection<Path> classpath,
                         String classname, String arg) {
  
!         List<String> commands = new ArrayList<>(sysProps);
  
          String cp = classpath.stream()
                  .map(Path::toString)
                  .collect(Collectors.joining(File.pathSeparator));
          commands.add("-cp");
          commands.add(cp);
          commands.add(classname);
          commands.add(arg);
  
!         return run(ProcessTools.createTestJavaProcessBuilder(commands));
      }
  
      static Result run(ProcessBuilder pb) {
          Process p = null;
          System.out.println("running: " + pb.command());
< prev index next >