apache / apache/maven-shared-jar

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

Open Beginner friendly
#138 1 comment 0 reactions 0 assignees View on GitHub
bug priority:minor
Dominant language
Java
Stars
4
Forks
9
Avg merge
2h 46m
Merged PRs (30d)
3

Description

In `JarClassesAnalysis.java:153-155`:

```java
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:
```java
JarVersionedRuntime rootContent = runtimeVersionsMap.remove(ROOT);
if (rootContent != null) {
jarData.setRootEntries(rootContent.getEntries());
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in JarClassesAnalysis.java at lines 153-155 and inspect how the ROOT entry is removed from runtimeVersionsMap. Exercise the analysis with a malformed multi-release JAR containing only META-INF/versions/N/ entries, and confirm processing completes without a NullPointerException when ROOT is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.