-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MNG-7834] Fix NullPointerException in flatten-maven-plugin #1195
[MNG-7834] Fix NullPointerException in flatten-maven-plugin #1195
Conversation
@@ -201,18 +201,25 @@ public class ${class.name} | |||
if (!Objects.equals(map, getDelegate().get${cap}())) { | |||
update(getDelegate().with${cap}(map)); | |||
} | |||
#else | |||
#elseif ( $field.to != "String" && $field.type == "java.util.List" && $field.multiplicity == "*" ) | |||
if (${field.name} == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the new code now looks like:
public void setDependencies(List<Dependency> dependencies) {
if (dependencies == null) {
dependencies = Collections.emptyList();
}
if (!Objects.equals(dependencies, getDependencies())) {
update(getDelegate().withDependencies(
dependencies.stream().map(c -> c.getDelegate()).collect(Collectors.toList())));
dependencies.forEach(e -> e.childrenTracking = this::replace);
}
}
#else | ||
} | ||
#elseif ( $field.to && $field.to != "String" ) | ||
if (!Objects.equals(${field.name}, ${pfx}${cap}())){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new code looks like:
public void setDistributionManagement(DistributionManagement distributionManagement) {
if (!Objects.equals(distributionManagement, getDistributionManagement())){
if (distributionManagement != null) {
update(getDelegate().withDistributionManagement(distributionManagement.getDelegate()));
distributionManagement.childrenTracking = this::replace;
} else {
update(getDelegate().withDistributionManagement(null));
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs tests
58f1361
to
43681d7
Compare
JIRA issue: https://issues.apache.org/jira/browse/MNG-7834
The flatten-maven-plugin fails with a NPE: