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

TestJpsJar shouldn't jar all test.classpath directories

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 8u371, 9
    • core-svc
    • b126
    • b146

    Description

      With JDK-8114827 "JDK 9 multi-release enabled jar tool" jar tool ignores second '-C <dir> .' folder, i.e.:
      jar -cf MyJar.jar -C <folder1> . -C <folder2> .

      In this case classes from <folder2> subfolders are absent in the MyJar.jar file.

      Looks like the problem in the following piece of code(src/jdk.jartool/share/classes/sun/tools/jar/Main.java):
          void expand(File dir,
                      String[] files,
                      boolean isUpdate,
                      Map<String,Path> moduleInfoPaths,
                      int version)
              throws IOException
          {
      ...
                  Entry entry = new Entry(version, f);
                  String entryName = entry.entryname;
      ...
                  } else if (f.isDirectory()) {
                      if (!entries.containsKey(entryName)) {
                          entries.put(entryName, entry);
                          if (isUpdate) {
                              entryMap.put(entryName, entry);
                          }
                          expand(f, f.list(), isUpdate, moduleInfoPaths, version);
                      }
                  } else {
      ...

      entryname for <folder1> and <folder2> will be the same, i.e. empty. And in this case if (!entries.containsKey(entryName)) { will be false and second(and others) folders are not proceeded.

      Attachments

        Issue Links

          Activity

            People

              dsamersoff Dmitriy Samersoff
              ddmitriev Dmitry Dmitriev
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: