-
Bug
-
Resolution: Fixed
-
P3
-
11, 17, 21, 22
-
b05
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8324352 | 22.0.1 | Weibing Xiao | P3 | Resolved | Fixed | b02 |
JDK-8323592 | 22 | Weibing Xiao | P3 | Resolved | Fixed | b32 |
JDK-8323325 | 21.0.3-oracle | Weibing Xiao | P3 | Resolved | Fixed | b02 |
JDK-8323777 | 21.0.3 | Goetz Lindenmaier | P3 | Resolved | Fixed | b01 |
JDK-8323327 | 17.0.11-oracle | Weibing Xiao | P3 | Resolved | Fixed | b02 |
JDK-8324062 | 17.0.11 | Goetz Lindenmaier | P3 | Resolved | Fixed | b01 |
JDK-8323328 | 11.0.23-oracle | Weibing Xiao | P3 | Resolved | Fixed | b02 |
JDK-8324818 | 11.0.23 | Goetz Lindenmaier | P3 | Resolved | Fixed | b01 |
The internal implementation of the jar tool in sun/tools/jar/Main.java, uses a flag called ok to keep track of whether there was any error during the jar tool action processing. This ok flag is marked by various methods that get invoked during the jar processing.
When -c or -u options are passed to the jar tool, the sun/tools/jar/Main.java calls an internal method expand(). This method is responsible for finalizing the files that need to be included in the jar that gets created or updated. This expand method is also responsible for marking that ok flag if there are any errors (like any file that was specified to be included/updated in the jar, is missing). Once the expand() method returns, the internal implementation detail of the jar tool will go ahead and create a temporary file. Content will be written out to this temporary file The more entries to create in the final jar being created/updated, the more time and disk space this temporary file will consume. Finally, when writing out to the temporary file is done, the ok flag is checked to see if it was flagged as failed. If ok says no errors were noticed, then the temporary file that was created will be moved as the final jar that had to be created/updated. If ok said that there were failures, then the temporary file is deleted and the final jar won't get created (rightly so) nor will the final jar get updated, in case of -u option (rightly so).
The issue here is that if the expand() method noticed that there was an error with the provided file paths, then it marks the ok flag to indicate that, but the current implementation of the jar tool just doesn't check the flag and goes on to do the expensive work of creating a temporary file and that temporary file will then finally get discarded at the end. This entire process of creating the temporary file can be avoided by checking the ok flag after the expand() method returns. This will improve the whole process of creating a jar file when some of the files are missing.
- backported by
-
JDK-8323325 Better Error Handling for Jar Tool When Processing Non-existent Files
- Resolved
-
JDK-8323327 Better Error Handling for Jar Tool When Processing Non-existent Files
- Resolved
-
JDK-8323328 Better Error Handling for Jar Tool When Processing Non-existent Files
- Resolved
-
JDK-8323592 Better Error Handling for Jar Tool When Processing Non-existent Files
- Resolved
-
JDK-8323777 Better Error Handling for Jar Tool When Processing Non-existent Files
- Resolved
-
JDK-8324062 Better Error Handling for Jar Tool When Processing Non-existent Files
- Resolved
-
JDK-8324352 Better Error Handling for Jar Tool When Processing Non-existent Files
- Resolved
-
JDK-8324818 Better Error Handling for Jar Tool When Processing Non-existent Files
- Resolved
- relates to
-
JDK-8158295 Add a multi-release jar validation mechanism to jar tool
- Resolved
- links to
-
Commit openjdk/jdk11u-dev/fbc60059
-
Commit openjdk/jdk17u-dev/769708f8
-
Commit openjdk/jdk21u-dev/4b829786
-
Commit openjdk/jdk22/3daa936f
-
Commit openjdk/jdk/8ae309eb
-
Review openjdk/jdk11u-dev/2484
-
Review openjdk/jdk17u-dev/2122
-
Review openjdk/jdk21u-dev/163
-
Review openjdk/jdk22/55
-
Review openjdk/jdk22/56
-
Review openjdk/jdk/16423
-
Review openjdk/jdk/17088