RFR: 8318971: jar v17 should either exit on error immediately or create archive as jar v1.8 did

Ryan Wallace duke at openjdk.org
Mon Nov 6 11:31:10 UTC 2023


On Mon, 30 Oct 2023 16:16:52 GMT, Ryan Wallace <duke at openjdk.org> wrote:

> Hi all,
> 
> Please review this fix for jar tool not producing archive if there is a missing file supplied. Fix is to throw an exception and exit processing when a missing file is supplied. Current behaviour will recognise missing file as an error but continue processing and not produce the archive. Updated ClassPath test to verify jar is not created.
> 
> Thanks,
> Ryan.

I had a look and its been in since JDK 9 (https://bugs.openjdk.org/browse/JDK-8158295) but haven’t found any mention of this as a specific desired behaviour so I am going with just noticed now. Its not a major blocker as the user can either make sure the missing file is in place or exclude it from being added to the archive and rerun. 

I agree it will need some thought, I was of the opinion that we should fail upfront and notify the user of why. The JDK 8 behaviour doesn’t make sense as the state is recognised as an error and there are tests to validate this, but they do not validate the archive has not been created, in my opinion we shouldn’t continue on and create it. There are other areas in the jar tool in 8 that will clean up (delete) the archive that has been created if there is an error, this case just seems to fall through the cracks.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/16423#issuecomment-1794612971


More information about the compiler-dev mailing list