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

TestJpsJar shouldn't jar all test.classpath directories

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-svc
    • Labels:
    • Subcomponent:
    • Introduced In Build:
      b126
    • Resolved In Build:
      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

              • Assignee:
                dsamersoff Dmitriy Samersoff
                Reporter:
                ddmitriev Dmitry Dmitriev
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: