You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2006/02/21 03:11:46 UTC

svn commit: r379310 - /maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java

Author: brett
Date: Mon Feb 20 18:11:43 2006
New Revision: 379310

URL: http://svn.apache.org/viewcvs?rev=379310&view=rev
Log:
[MNG-2087] NPE in PluginXdocGenerator
Submitted by: Vincent Siveton

Modified:
    maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java

Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java?rev=379310&r1=379309&r2=379310&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginXdocGenerator.java Mon Feb 20 18:11:43 2006
@@ -158,65 +158,68 @@
 
         List mojos = pluginDescriptor.getMojos();
 
-        for ( Iterator i = mojos.iterator(); i.hasNext(); )
+        if ( mojos != null )
         {
-            MojoDescriptor mojo = (MojoDescriptor) i.next();
+            for ( Iterator i = mojos.iterator(); i.hasNext(); )
+            {
+                MojoDescriptor mojo = (MojoDescriptor) i.next();
 
-            w.startElement( "tr" );
+                w.startElement( "tr" );
 
-            // ----------------------------------------------------------------------
-            //
-            // ----------------------------------------------------------------------
+                // ----------------------------------------------------------------------
+                //
+                // ----------------------------------------------------------------------
 
-            w.startElement( "td" );
+                w.startElement( "td" );
 
-            String paramName = mojo.getFullGoalName();
+                String paramName = mojo.getFullGoalName();
 
-            w.startElement( "a" );
+                w.startElement( "a" );
 
-            w.addAttribute( "href", getMojoFilename( mojo, "html" ) );
+                w.addAttribute( "href", getMojoFilename( mojo, "html" ) );
 
-            w.startElement( "code" );
+                w.startElement( "code" );
 
-            w.writeText( paramName );
+                w.writeText( paramName );
 
-            w.endElement();
+                w.endElement();
 
-            w.endElement();
+                w.endElement();
 
-            w.endElement();
+                w.endElement();
 
-            // ----------------------------------------------------------------------
-            //
-            // ----------------------------------------------------------------------
+                // ----------------------------------------------------------------------
+                //
+                // ----------------------------------------------------------------------
 
-            w.startElement( "td" );
+                w.startElement( "td" );
 
-            if ( StringUtils.isNotEmpty( mojo.getDescription() ) )
-            {
-                w.writeMarkup( mojo.getDescription() );
-            }
-            else
-            {
-                w.writeText( "No description." );
-            }
+                if ( StringUtils.isNotEmpty( mojo.getDescription() ) )
+                {
+                    w.writeMarkup( mojo.getDescription() );
+                }
+                else
+                {
+                    w.writeText( "No description." );
+                }
 
-            String deprecationWarning = mojo.getDeprecated();
-            if ( deprecationWarning != null )
-            {
-                w.writeMarkup( "<br/><b>Deprecated:</b> " );
-                w.writeMarkup( deprecationWarning );
-                if ( deprecationWarning.length() == 0 )
+                String deprecationWarning = mojo.getDeprecated();
+                if ( deprecationWarning != null )
                 {
-                    w.writeText( "No reason given." );
+                    w.writeMarkup( "<br/><b>Deprecated:</b> " );
+                    w.writeMarkup( deprecationWarning );
+                    if ( deprecationWarning.length() == 0 )
+                    {
+                        w.writeText( "No reason given." );
+                    }
+
+                    w.endElement();
                 }
 
                 w.endElement();
-            }
-
-            w.endElement();
 
-            w.endElement();
+                w.endElement();
+            }
         }
 
         w.endElement();
@@ -323,143 +326,146 @@
 
         List parameters = mojoDescriptor.getParameters();
 
-        for ( int i = 0; i < parameters.size(); i++ )
+        if ( parameters != null )
         {
-            Parameter parameter = (Parameter) parameters.get( i );
+            for ( int i = 0; i < parameters.size(); i++ )
+            {
+                Parameter parameter = (Parameter) parameters.get( i );
 
-            w.startElement( "tr" );
+                w.startElement( "tr" );
 
-            // ----------------------------------------------------------------------
-            //
-            // ----------------------------------------------------------------------
+                // ----------------------------------------------------------------------
+                //
+                // ----------------------------------------------------------------------
 
-            w.startElement( "td" );
+                w.startElement( "td" );
 
-            String paramName = parameter.getAlias();
+                String paramName = parameter.getAlias();
 
-            if ( StringUtils.isEmpty( paramName ) )
-            {
-                paramName = parameter.getName();
-            }
+                if ( StringUtils.isEmpty( paramName ) )
+                {
+                    paramName = parameter.getName();
+                }
 
-            w.startElement( "code" );
+                w.startElement( "code" );
 
-            w.writeText( paramName );
+                w.writeText( paramName );
 
-            w.endElement(); // code
+                w.endElement(); // code
 
-            if ( !parameter.isRequired() )
-            {
-                w.writeMarkup( " <i>(Optional)</i>" );
-            }
+                if ( !parameter.isRequired() )
+                {
+                    w.writeMarkup( " <i>(Optional)</i>" );
+                }
 
-            if ( parameter.getExpression() != null && parameter.getExpression().startsWith( "${component." ) )
-            {
-                w.writeMarkup( " <i>(Discovered)</i>" );
-            }
-            else if ( parameter.getRequirement() != null )
-            {
-                w.writeMarkup( " <i>(Discovered)</i>" );
-            }
+                if ( parameter.getExpression() != null && parameter.getExpression().startsWith( "${component." ) )
+                {
+                    w.writeMarkup( " <i>(Discovered)</i>" );
+                }
+                else if ( parameter.getRequirement() != null )
+                {
+                    w.writeMarkup( " <i>(Discovered)</i>" );
+                }
 
-            w.endElement(); // td
+                w.endElement(); // td
 
-            // ----------------------------------------------------------------------
-            //
-            // ----------------------------------------------------------------------
+                // ----------------------------------------------------------------------
+                //
+                // ----------------------------------------------------------------------
 
-            w.startElement( "td" );
+                w.startElement( "td" );
 
-            w.startElement( "code" );
+                w.startElement( "code" );
 
-            w.addAttribute( "title", parameter.getType() );
+                w.addAttribute( "title", parameter.getType() );
 
-            int index = parameter.getType().lastIndexOf( "." );
-            if ( index >= 0 )
-            {
-                w.writeText( parameter.getType().substring( index + 1 ) );
-            }
-            else
-            {
-                w.writeText( parameter.getType() );
-            }
+                int index = parameter.getType().lastIndexOf( "." );
+                if ( index >= 0 )
+                {
+                    w.writeText( parameter.getType().substring( index + 1 ) );
+                }
+                else
+                {
+                    w.writeText( parameter.getType() );
+                }
 
-            w.endElement(); // code
+                w.endElement(); // code
 
-            w.endElement(); // td
+                w.endElement(); // td
 
-            // ----------------------------------------------------------------------
-            //
-            // ----------------------------------------------------------------------
+                // ----------------------------------------------------------------------
+                //
+                // ----------------------------------------------------------------------
 
-            w.startElement( "td" );
+                w.startElement( "td" );
 
-            w.startElement( "code" );
+                w.startElement( "code" );
 
-            if ( StringUtils.isNotEmpty( parameter.getExpression() ) &&
-                !parameter.getExpression().startsWith( "${component." ) )
-            {
-                w.writeText( parameter.getExpression() );
-            }
-            else
-            {
-                w.writeText( "-" );
-            }
+                if ( StringUtils.isNotEmpty( parameter.getExpression() ) &&
+                    !parameter.getExpression().startsWith( "${component." ) )
+                {
+                    w.writeText( parameter.getExpression() );
+                }
+                else
+                {
+                    w.writeText( "-" );
+                }
 
-            w.endElement(); // code
+                w.endElement(); // code
 
-            w.endElement(); // td
+                w.endElement(); // td
 
-            // ----------------------------------------------------------------------
-            //
-            // ----------------------------------------------------------------------
+                // ----------------------------------------------------------------------
+                //
+                // ----------------------------------------------------------------------
 
-            w.startElement( "td" );
+                w.startElement( "td" );
 
-            w.startElement( "code" );
+                w.startElement( "code" );
 
-            if ( StringUtils.isNotEmpty( parameter.getDefaultValue() ) )
-            {
-                w.writeText( parameter.getDefaultValue() );
-            }
-            else
-            {
-                w.writeText( "-" );
-            }
+                if ( StringUtils.isNotEmpty( parameter.getDefaultValue() ) )
+                {
+                    w.writeText( parameter.getDefaultValue() );
+                }
+                else
+                {
+                    w.writeText( "-" );
+                }
 
-            w.endElement(); // code
+                w.endElement(); // code
 
-            w.endElement(); // td
+                w.endElement(); // td
 
-            // ----------------------------------------------------------------------
-            //
-            // ----------------------------------------------------------------------
+                // ----------------------------------------------------------------------
+                //
+                // ----------------------------------------------------------------------
 
-            w.startElement( "td" );
+                w.startElement( "td" );
 
-            if ( StringUtils.isNotEmpty( parameter.getDescription() ) )
-            {
-                w.writeMarkup( parameter.getDescription() );
-            }
-            else
-            {
-                w.writeText( "No description." );
-            }
+                if ( StringUtils.isNotEmpty( parameter.getDescription() ) )
+                {
+                    w.writeMarkup( parameter.getDescription() );
+                }
+                else
+                {
+                    w.writeText( "No description." );
+                }
 
-            String deprecationWarning = parameter.getDeprecated();
-            if ( deprecationWarning != null )
-            {
-                w.writeMarkup( "<br/><b>Deprecated:</b> " );
-                w.writeMarkup( deprecationWarning );
-                if ( deprecationWarning.length() == 0 )
+                String deprecationWarning = parameter.getDeprecated();
+                if ( deprecationWarning != null )
                 {
-                    w.writeText( "No reason given." );
+                    w.writeMarkup( "<br/><b>Deprecated:</b> " );
+                    w.writeMarkup( deprecationWarning );
+                    if ( deprecationWarning.length() == 0 )
+                    {
+                        w.writeText( "No reason given." );
+                    }
                 }
-            }
 
-            w.endElement(); // td
+                w.endElement(); // td
 
-            w.endElement(); // tr
+                w.endElement(); // tr
+            }
         }
 
         w.endElement(); // table