JDK-8165500 : TestJpsJar shouldn't jar all test.classpath directories
  • Type: Bug
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 8u371,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-09-06
  • Updated: 2023-09-12
  • Resolved: 2016-10-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b146Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8165513 :  
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.
Comments
URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/b60ef7010504 User: lana Date: 2016-11-22 22:03:29 +0000
22-11-2016

URL: http://hg.openjdk.java.net/jdk9/jdk9/rev/eeb794d72bbf User: lana Date: 2016-11-22 22:03:18 +0000
22-11-2016

URL: http://hg.openjdk.java.net/jdk9/hs/jdk/rev/b60ef7010504 User: dsamersoff Date: 2016-10-25 12:46:41 +0000
25-10-2016

URL: http://hg.openjdk.java.net/jdk9/hs/rev/eeb794d72bbf User: dsamersoff Date: 2016-10-25 12:46:40 +0000
25-10-2016

[~dsamersoff]: Dmitry, why fix version is not "9"? It's looks like a regression for jar tool. Thanks.
08-09-2016