elharo opened a new issue, #512:
URL: https://github.com/apache/maven-ear-plugin/issues/512
## Description
In `AbstractEarModule.java:336-338`, a NullPointerException occurs if
`generateId` is true but the artifact has not been resolved:
```java
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:
```java
if (generateId) {
Artifact theArtifact = getArtifact();
if (theArtifact == null) {
return;
}
...
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]