Skip to content

getJarClasses() throws NPE for missing version key in JarVersionedRuntimes #135

Description

@elharo

In JarVersionedRuntimes.java:47-49:

public JarClasses getJarClasses(Integer version) {
    return versionedRuntimeMap.get(version).getJarClasses();  // NPE if version absent
}

If the requested version is not a key in the map, get(version) returns null, then .getJarClasses() throws a NullPointerException. This is inconsistent with getJarVersionedRuntime() on the same class, which safely returns null for missing keys. Any caller querying a non-existent version will crash.

Fix: Guard against null, e.g.:

JarVersionedRuntime runtime = versionedRuntimeMap.get(version);
return runtime != null ? runtime.getJarClasses() : null;

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:majorMajor loss of function

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions