You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Vincent Siveton (JIRA)" <ji...@codehaus.org> on 2007/08/04 14:49:13 UTC

[jira] Closed: (MJAVADOC-139) NPE out of AbstractJavadocMojo::getSourcePaths() on multimodule project using aggregate

     [ http://jira.codehaus.org/browse/MJAVADOC-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vincent Siveton closed MJAVADOC-139.
------------------------------------

    Resolution: Fixed

Fixed

> NPE out of AbstractJavadocMojo::getSourcePaths() on multimodule project using aggregate
> ---------------------------------------------------------------------------------------
>
>                 Key: MJAVADOC-139
>                 URL: http://jira.codehaus.org/browse/MJAVADOC-139
>             Project: Maven 2.x Javadoc Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: John Allen
>            Assignee: Vincent Siveton
>             Fix For: 2.4
>
>
> My main concern is this area of the code:
> AbstractJavadocMojo::getSourcePaths()
> {code}
>    /**
>      * Method to get the source paths. If no source path is specified in the parameter, the compile source roots
>      * of the project will be used.
>      *
>      * @return a List of the project source paths
>      */
>     protected List getSourcePaths()
>     {
>         List sourcePaths;
>         if ( StringUtils.isEmpty( sourcepath ) )
>         {
>             sourcePaths = new ArrayList( getProjectSourceRoots( project ) );
>             if ( project.getExecutionProject() != null )
>             {
>                 sourcePaths.addAll( getExecutionProjectSourceRoots( project ) );
>             }
>             if ( getJavadocDirectory() != null )
>             {
>                 File javadocDir = getJavadocDirectory();
>                 if ( javadocDir.exists() && javadocDir.isDirectory() )
>                 {
>                     sourcePaths.add( getJavadocDirectory().getAbsolutePath() );
>                 }
>             }
>             if ( aggregate && project.isExecutionRoot() )
>             {
>                 for ( Iterator i = reactorProjects.iterator(); i.hasNext(); )
>                 {
>                     MavenProject subProject = (MavenProject) i.next();
>                     if ( subProject != project )
>                     {
>                         List sourceRoots = getProjectSourceRoots( subProject );
> {code}
> *HERE WE CHECK IF subProject.getExecutionProject() IS NOT EQUAL TO NULL*
> {code}
>                         if ( subProject.getExecutionProject() != null )
>                         {
>                             sourceRoots.addAll( getExecutionProjectSourceRoots( subProject ) );
>                         }
>                         ArtifactHandler artifactHandler = subProject.getArtifact().getArtifactHandler();
>                         if ( "java".equals( artifactHandler.getLanguage() ) )
>                         {
>                             sourcePaths.addAll( sourceRoots );
>                         }
> {code}
> *BUT NOW WE TRY AND DEREFERENCE subProject.getExecutionProject() REGARDLESS - RESULTS IN NPE*
> {code}
>                         String javadocDirRelative = PathUtils.toRelative( project.getBasedir(), getJavadocDirectory().getAbsolutePath() );
>                         File javadocDir = new File( subProject.getExecutionProject().getBasedir(), javadocDirRelative );
>                         if ( javadocDir.exists() && javadocDir.isDirectory() )
>                         {
>                             sourcePaths.add( javadocDir.getAbsolutePath() );
>                         }
>                     }
>                 }
>             }
>             sourcePaths = pruneSourceDirs( sourcePaths );
>         }
>         else
>         {
>             sourcePaths = new ArrayList( Arrays.asList( sourcepath.split( "[;]" ) ) );
>             if ( getJavadocDirectory() != null )
>             {
>                 sourcePaths.add( getJavadocDirectory().getAbsolutePath() );
>             }
>             sourcePaths = pruneSourceDirs( sourcePaths );
>         }
>         return sourcePaths;
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira