Skip to content

Missing ROOT key causes NPE in JarClassesAnalysis for malformed MR-JARs #138

Description

@elharo

In JarClassesAnalysis.java:153-155:

JarVersionedRuntime rootContentVersionedRuntime = runtimeVersionsMap.remove(ROOT);
jarData.setRootEntries(rootContentVersionedRuntime.getEntries());  // NPE if no ROOT

If a malformed multi-release JAR has no root-level entries (every entry is under META-INF/versions/N/), runtimeVersionsMap has no ROOT key, remove(ROOT) returns null, and .getEntries() throws a NullPointerException.

Fix: Guard against null:

JarVersionedRuntime rootContent = runtimeVersionsMap.remove(ROOT);
if (rootContent != null) {
    jarData.setRootEntries(rootContent.getEntries());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:minorMinor loss of function, or other problem where easy workaround is present

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions