Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8142967

[TESTBUG] Compiler control tests get NullPointerException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • hotspot
    • b96

      FIles.copy gets NPE because "is" is null.

      public class ClassFileInstaller {
          /**
           * @param args The names of the classes to dump
           * @throws Exception
           */
          public static void main(String... args) throws Exception {
              for (String arg : args) {
                  ClassLoader cl = ClassFileInstaller.class.getClassLoader();

                  // Convert dotted class name to a path to a class file
                  String pathName = arg.replace('.', '/').concat(".class");
                  InputStream is = cl.getResourceAsStream(pathName);

                  // Create the class file's package directory
                  Path p = Paths.get(pathName);
                  if (pathName.contains("/")) {
                      Files.createDirectories(p.getParent());
                  }
                  // Create the class file
                  Files.copy(is, p, StandardCopyOption.REPLACE_EXISTING);
              }
          }
      }

            ppunegov Pavel Punegov
            jprovino Joseph Provino (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: