You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2026/07/20 10:14:08 UTC
[I] getJarClasses() throws NPE for missing version key in JarVersionedRuntimes [maven-shared-jar]
elharo opened a new issue, #135:
URL: https://github.com/apache/maven-shared-jar/issues/135
In `JarVersionedRuntimes.java:47-49`:
```java
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.:
```java
JarVersionedRuntime runtime = versionedRuntimeMap.get(version);
return runtime != null ? runtime.getJarClasses() : null;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] getJarClasses() throws NPE for missing version key in JarVersionedRuntimes [maven-shared-jar]
Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz closed issue #135: getJarClasses() throws NPE for missing version key in JarVersionedRuntimes
URL: https://github.com/apache/maven-shared-jar/issues/135
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org