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:40:04 UTC 2024


On Mon, 26 Aug 2024 15:27:39 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/loader/URLClassPath.java line 470:
>> 
>>> 468:                 continue;
>>> 469:             }
>>> 470:             if (loaderClassPathURLs != null) {
>> 
>> I'm missing something here. Why does the compiler not complain that `loaderClassPathURLs` might not be initialized, when it's accessed here?
>
> Because we would not reach here - since it's either assigned at line 447 or we continue at line 457, 468, or exit throwing an uncaught exception?

Is the if statement at line 470 redundant then? Presumably the code can reach here.

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

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


More information about the core-libs-dev mailing list