RFR: 8338445: jdk.internal.loader.URLClassPath may leak JarFile instance when dealing with unexpected Class-Path entry in manifest [v2]

Michael McMahon michaelm at openjdk.org
Mon Aug 26 15:51:02 UTC 2024


On Mon, 26 Aug 2024 15:36:25 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Is the if statement at line 470 redundant then? Presumably the code can reach here.
>
> Hello Michael,
>> Is the if statement at line 470 redundant then?
> 
> `Loader.getClassPath()` can return null (and it does for some implementations of Loader). So the null check would still be needed.

What if `getLoader(url)` throws an exception so `Loader.getClassPath()` is not called? Okay, I see Daniel's point, that in that case, the code is not reached.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20691#discussion_r1731446869


More information about the core-libs-dev mailing list