On Tue, 29 Sep 2026 15:42:47 GMT, Jaikiran Pai <[email protected]> wrote:

>> Can I please get a review of this change which proposes to improve the error 
>> message when a JAR file with no manifest is used to launch a java 
>> application using `java -jar <jarfile>` command? This addresses 
>> https://bugs.openjdk.org/browse/JDK-8392966.
>> 
>> With the changes in this PR, for a JAR without a manifest file, if it is 
>> launched using `java -jar foo.jar` command then the error message will now 
>> say:
>> 
>>> Error: No manifest in JAR file foo.jar
>> 
>> An existing jtreg test has been converted to junit and a new test method has 
>> been introduced to verify this change. tier1, tier2 and tier3 continue to 
>> pass after this change.
>> 
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Jaikiran Pai has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains seven additional 
> commits since the last revision:
> 
>  - include invalid/corrupt word in the manifest parsing message
>  - remove ternary operator
>  - merge latest from master branch
>  - merge latest from master branch
>  - remove incorrect comment about localization of error messages
>  - update test
>  - 8392966: Improve error message for executable JAR file

src/java.base/share/native/libjli/parse_manifest.c line 439:

> 437:     }
> 438:     free(buffer);
> 439:     return -2;        /* entry not found in the ZIP/JAR */

The comment on the loop has "Note that a valid zip/jar must have an ENDHDR 
(with ENDSIG) after the Central Directory".  Is the existing code missing a 
ENDSIG_AT to decide if it should return -1 or 2 ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33064#discussion_r4136335552

Reply via email to