RFR: 8318971: jar v17 should either exit on error immediately or create archive as jar v1.8 did
Jaikiran Pai
jpai at openjdk.org
Tue Nov 7 12:09:32 UTC 2023
On Tue, 7 Nov 2023 11:04:14 GMT, Ryan Wallace <duke at openjdk.org> wrote:
> the issue with the current functionality on the mainline is that the jar tool is still processing and creating the temp jar file, it just doesn't move it to the working directory where the tool was ran from because there was a missing file supplied and then deletes the temp jar. If you were to run this with many/larger files that causes the jartool to take more time it is more noticeable.
Thank you for that detail. I now understand what we are attempting to improve.
In that case, could you experiment by the changing the call sites of `expand(...)` method? Right now in mainline, `expand(...)` method is where we check if a file exists or not and when absent we write a error message and set the `ok = false`.
The current proposed change in this PR throws an exception from here instead of writing the error message and setting `ok = false`. What we could do perhaps, is let expand(...) method continue to stay as-is and continue to write those error messages and set `ok = false`. Then at the call site(s) of expand() where we then create and write to the temporary jar file, we should probably first check if `ok = false` and if it is `false` then just return `false` from the `run()` method so that the temporary jar isn't created and the command exits with a non-zero exit code. That way we still report all missing files and don't end up creating the temporary jar. I haven't looked at the code in detail to see if this is feasible and/or if there are other issues this will show up.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16423#issuecomment-1798375151
More information about the compiler-dev
mailing list