maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karl Heinz Marbaise (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (MNG-6170) NPE in cases using Multithreaded -T X versions:set -DnewVersion=1.0-SNAPSHOT
Date Sun, 19 Feb 2017 12:56:44 GMT

     [ https://issues.apache.org/jira/browse/MNG-6170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Karl Heinz Marbaise updated MNG-6170:
-------------------------------------
    Description: 
Based on the [issue|https://github.com/mojohaus/versions-maven-plugin/issues/54] marked for
the versions-maven-plugin investigation shows that the real cause of this problem is located
in maven-core.

The short description of the problem is calling Maven via: {{mvn -T 20 versions:set -DnewVersion=1.0-SNAPSHOT}}
you will get an NPE.

 I identified the following point in code as culprit for the problem:

MultiThreadedBuilder.java
{code}
        // for each finished project
        for ( int i = 0; i < analyzer.getNumberOfBuilds(); i++ )
        {
            try
            {
                ProjectSegment projectBuild = service.take().get();
                if ( reactorContext.getReactorBuildStatus().isHalted() )
                {
                    break;
                }
                final List<MavenProject> newItemsThatCanBeBuilt =
                    analyzer.markAsFinished( projectBuild.getProject() );
                for ( MavenProject mavenProject : newItemsThatCanBeBuilt )
                {
                    ProjectSegment scheduledDependent = projectBuildList.get( mavenProject
);
                    logger.debug( "Scheduling: " + scheduledDependent );
                    Callable<ProjectSegment> cb =
                        createBuildCallable( rootSession, scheduledDependent, reactorContext,
taskSegment, muxer );
                    service.submit( cb );
                }
            }
            catch ( InterruptedException e )
            {
                rootSession.getResult().addException( e );
                break;
            }
            catch ( ExecutionException e )
            {
                // TODO MNG-5766 changes likely made this redundant 
                rootSession.getResult().addException( e );
                break;
            }
        }
{code}

And the problematic part is before the second debugging output line:
{code}
                    ProjectSegment scheduledDependent = projectBuildList.get( mavenProject
);
                    logger.debug( "Scheduling: " + scheduledDependent );
                    Callable<ProjectSegment> cb =
                        createBuildCallable( rootSession, scheduledDependent, reactorContext,
taskSegment, muxer );
                    service.submit( cb );
{code}
Cause it happens that the {{scheduledDependent}} could be null which will cause the issue.
This -looks like- is a regression, cause in Maven 3.0.5 it works without any issue.

Update:
I have found other examples where the NPE occurs:
 * {{mvn -T20 javadoc:aggregate}}
 * {{mvn -T20 install:install-file ...}}
This can cause confusion if you are using {{mvn.config}} and put thing like {{-T X}} into
it.

  was:
Based on the [issue|https://github.com/mojohaus/versions-maven-plugin/issues/54] marked for
the versions-maven-plugin investigation shows that the real cause of this problem is located
in maven-core.

The short description of the problem is calling Maven via: {{mvn -T 20 versions:set -DnewVersion=1.0-SNAPSHOT}}
you will get an NPE.

 I identified the following point in code as culprit for the problem:

MultiThreadedBuilder.java
{code}
        // for each finished project
        for ( int i = 0; i < analyzer.getNumberOfBuilds(); i++ )
        {
            try
            {
                ProjectSegment projectBuild = service.take().get();
                if ( reactorContext.getReactorBuildStatus().isHalted() )
                {
                    break;
                }
                final List<MavenProject> newItemsThatCanBeBuilt =
                    analyzer.markAsFinished( projectBuild.getProject() );
                for ( MavenProject mavenProject : newItemsThatCanBeBuilt )
                {
                    ProjectSegment scheduledDependent = projectBuildList.get( mavenProject
);
                    logger.debug( "Scheduling: " + scheduledDependent );
                    Callable<ProjectSegment> cb =
                        createBuildCallable( rootSession, scheduledDependent, reactorContext,
taskSegment, muxer );
                    service.submit( cb );
                }
            }
            catch ( InterruptedException e )
            {
                rootSession.getResult().addException( e );
                break;
            }
            catch ( ExecutionException e )
            {
                // TODO MNG-5766 changes likely made this redundant 
                rootSession.getResult().addException( e );
                break;
            }
        }
{code}

And the problematic part is before the second debugging output line:
{code}
                    ProjectSegment scheduledDependent = projectBuildList.get( mavenProject
);
                    logger.debug( "Scheduling: " + scheduledDependent );
                    Callable<ProjectSegment> cb =
                        createBuildCallable( rootSession, scheduledDependent, reactorContext,
taskSegment, muxer );
                    service.submit( cb );
{code}
Cause it happens that the {{scheduledDependent}} could be null which will cause the issue.
This -looks like- is a regression, cause in Maven 3.0.5 it works without any issue.

Update:
I have found another example where the NPE occurs: {{mvn -T20 javadoc:aggregate}}


> NPE in cases using Multithreaded -T X versions:set -DnewVersion=1.0-SNAPSHOT
> ----------------------------------------------------------------------------
>
>                 Key: MNG-6170
>                 URL: https://issues.apache.org/jira/browse/MNG-6170
>             Project: Maven
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.1.1, 3.2.5, 3.3.1, 3.3.9
>            Reporter: Karl Heinz Marbaise
>            Assignee: Karl Heinz Marbaise
>             Fix For: 3.5.1
>
>
> Based on the [issue|https://github.com/mojohaus/versions-maven-plugin/issues/54] marked
for the versions-maven-plugin investigation shows that the real cause of this problem is located
in maven-core.
> The short description of the problem is calling Maven via: {{mvn -T 20 versions:set -DnewVersion=1.0-SNAPSHOT}}
you will get an NPE.
>  I identified the following point in code as culprit for the problem:
> MultiThreadedBuilder.java
> {code}
>         // for each finished project
>         for ( int i = 0; i < analyzer.getNumberOfBuilds(); i++ )
>         {
>             try
>             {
>                 ProjectSegment projectBuild = service.take().get();
>                 if ( reactorContext.getReactorBuildStatus().isHalted() )
>                 {
>                     break;
>                 }
>                 final List<MavenProject> newItemsThatCanBeBuilt =
>                     analyzer.markAsFinished( projectBuild.getProject() );
>                 for ( MavenProject mavenProject : newItemsThatCanBeBuilt )
>                 {
>                     ProjectSegment scheduledDependent = projectBuildList.get( mavenProject
);
>                     logger.debug( "Scheduling: " + scheduledDependent );
>                     Callable<ProjectSegment> cb =
>                         createBuildCallable( rootSession, scheduledDependent, reactorContext,
taskSegment, muxer );
>                     service.submit( cb );
>                 }
>             }
>             catch ( InterruptedException e )
>             {
>                 rootSession.getResult().addException( e );
>                 break;
>             }
>             catch ( ExecutionException e )
>             {
>                 // TODO MNG-5766 changes likely made this redundant 
>                 rootSession.getResult().addException( e );
>                 break;
>             }
>         }
> {code}
> And the problematic part is before the second debugging output line:
> {code}
>                     ProjectSegment scheduledDependent = projectBuildList.get( mavenProject
);
>                     logger.debug( "Scheduling: " + scheduledDependent );
>                     Callable<ProjectSegment> cb =
>                         createBuildCallable( rootSession, scheduledDependent, reactorContext,
taskSegment, muxer );
>                     service.submit( cb );
> {code}
> Cause it happens that the {{scheduledDependent}} could be null which will cause the issue.
> This -looks like- is a regression, cause in Maven 3.0.5 it works without any issue.
> Update:
> I have found other examples where the NPE occurs:
>  * {{mvn -T20 javadoc:aggregate}}
>  * {{mvn -T20 install:install-file ...}}
> This can cause confusion if you are using {{mvn.config}} and put thing like {{-T X}}
into it.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message