RFR: 8293499: Provide jmod --compress option [v4]
Aleksey Shipilev
shade at openjdk.org
Tue Sep 13 09:31:50 UTC 2022
On Tue, 13 Sep 2022 08:10:28 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
>>
>> More review comments
>
> src/jdk.jlink/share/classes/jdk/tools/jmod/JmodOutputStream.java line 66:
>
>> 64: private final ZipOutputStream zos;
>> 65: private final LocalDateTime date;
>> 66: private JmodOutputStream(OutputStream out, LocalDateTime date, int compLevel) {
>
> Nit - I think this should be `compressLevel` just like the param name to the static method.
Right, done so.
> src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java line 1196:
>
>> 1194: }
>> 1195: try {
>> 1196: int level = Integer.parseInt(value.substring(idx + 1));
>
> If I'm reading this code correctly, then this call to `substring` can potentially end in a `IndexOutOfBoundsException` if the value is `zip-`. Perhaps add a check above to verify that `idx != value.length()`?
`String.substring` does the right thing when `idx == length()` -- it returns the empty string, which would fail to parse. Anyway, I added the test for "zip-" to verify this.
-------------
PR: https://git.openjdk.org/jdk/pull/10213
More information about the core-libs-dev
mailing list