From 40d47927dee5a419ad71add6a80789bfd07e52ee Mon Sep 17 00:00:00 2001 From: Trygve Laugstol Date: Sat, 4 Jun 2005 13:24:17 +0000 Subject: [PATCH] o Fixing a small bug that would cause a NPE if a plugin doesn't contain any mojos. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@179987 13f79535-47bb-0310-9956-ffa450edef68 --- .../plugin/generator/PluginDescriptorGenerator.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java b/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java index 1f0166a055..b27782b768 100644 --- a/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java +++ b/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java @@ -76,10 +76,13 @@ public class PluginDescriptorGenerator w.startElement( "mojos" ); - for ( Iterator it = pluginDescriptor.getMojos().iterator(); it.hasNext(); ) + if ( pluginDescriptor.getMojos() != null ) { - MojoDescriptor descriptor = (MojoDescriptor) it.next(); - processMojoDescriptor( descriptor, w ); + for ( Iterator it = pluginDescriptor.getMojos().iterator(); it.hasNext(); ) + { + MojoDescriptor descriptor = (MojoDescriptor) it.next(); + processMojoDescriptor( descriptor, w ); + } } w.endElement(); @@ -362,4 +365,4 @@ public class PluginDescriptorGenerator w.endElement(); } -} \ No newline at end of file +}