michael-o commented on PR #253: URL: https://github.com/apache/maven-plugin-tools/pull/253#issuecomment-1872263806
> Parameter list can be null ... we also need a fix like: > > ```diff > --- a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugins/plugin/descriptor/EnhancedPluginDescriptorBuilder.java > +++ b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugins/plugin/descriptor/EnhancedPluginDescriptorBuilder.java > @@ -21,9 +21,11 @@ package org.apache.maven.plugins.plugin.descriptor; > import java.io.Reader; > import java.net.URI; > import java.util.ArrayList; > +import java.util.Collections; > import java.util.LinkedHashMap; > import java.util.List; > import java.util.Map; > +import java.util.Optional; > > import org.apache.maven.plugin.descriptor.MojoDescriptor; > import org.apache.maven.plugin.descriptor.Parameter; > @@ -87,7 +89,8 @@ public class EnhancedPluginDescriptorBuilder extends PluginDescriptorBuilder { > > PlexusConfiguration[] parameterConfigurations = c.getChild("parameters").getChildren("parameter"); > > - List<Parameter> parameters = new ArrayList<>(mojoDescriptor.getParameters()); > + List<Parameter> parameters = new ArrayList<>( > + Optional.ofNullable(mojoDescriptor.getParameters()).orElseGet(Collections::emptyList)); > Map<String, Parameter> parameterMap = new LinkedHashMap<>(mojoDescriptor.getParameterMap()); > > for (PlexusConfiguration d : parameterConfigurations) { > @@ -108,7 +111,9 @@ public class EnhancedPluginDescriptorBuilder extends PluginDescriptorBuilder { > } > > // clear() is required for maven < 3.6.2 > - mojoDescriptor.getParameters().clear(); > + if (mojoDescriptor.getParameters() != null) { > + mojoDescriptor.getParameters().clear(); > + } > ``` Thanks, working on this. I consider `org.apache.maven.plugin.descriptor.MojoDescriptor.setParameters(List<Parameter>)` to be misdesigned. This method uses `#addParameter()` instead of replacing the entire list. Or the method should be `org.apache.maven.plugin.descriptor.MojoDescriptor.addParameters(List<Parameter>)`. -- 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-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org