-
Bug
-
Resolution: Fixed
-
P3
-
8u371, 9
-
b126
-
b146
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.
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.
- relates to
-
JDK-8165944 jar utility doesn't process more than one -C argument
- Closed
-
JDK-8165490 [TESTBUG] sun/tools/jps/TestJpsJar.java still fails with ClassNotFoundException: jdk.testlibrary.ProcessTools
- Closed
-
JDK-8114827 JDK 9 multi-release enabled jar tool
- Resolved