NullPointerException in AbstractEarModule when generating module ID with unresolved artifact
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- java
- Domain
- build-system
Research direction
Start with AbstractEarModule.java:336-338 and the EarModule interface documentation for getArtifact(). Exercise the generateId path with an unresolved artifact and verify that it no longer throws a NullPointerException while resolved artifacts still receive their generated IDs.
Written by the indexing model from the issue text.
Description
Description
In AbstractEarModule.java:336-338, a NullPointerException occurs if generateId is true but the artifact has not been resolved:
if (generateId) {
Artifact theArtifact = getArtifact();
String generatedId = theArtifact.getType().toUpperCase() + "_" + theArtifact.getGroupId() + "."
+ theArtifact.getArtifactId();
getArtifact() is documented in the EarModule interface as returning null until the artifact is resolved. If a module's artifact is not yet resolved when generateId is true, .getType() throws an NPE.
Expected behavior
Add a null check before generating the ID:
if (generateId) {
Artifact theArtifact = getArtifact();
if (theArtifact == null) {
return;
}
...
}
- Dominant language
- Java
- Stars
- 14
- Forks
- 29
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 8
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/maven-ear-plugin
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/maven-ear-plugin#519 · 1 comment ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
apache/maven-ear-plugin#516 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
apache/maven-ear-plugin#517 ·
-
bug
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
apache/maven-ear-plugin#515 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
apache/maven-ear-plugin#514 ·
All issues in apache/maven-ear-plugin
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100