NPE when using Git SCM 1.2-SNAPSHOT
-----------------------------------

                 Key: SCM-441
                 URL: http://jira.codehaus.org/browse/SCM-441
             Project: Maven SCM
          Issue Type: Bug
          Components: maven-scm-api
    Affects Versions: 1.1
         Environment: Linux and MacOSX, probably everywhere
            Reporter: Petter Måhlén


This is the log message:
---
[INFO] Storing revision in 'scm.revision' project property.
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] null
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:394)
        at org.apache.maven.scm.plugin.UpdateMojo.execute(UpdateMojo.java:103)
---

Looking at the code:

    public void execute()
        throws MojoExecutionException
    {
        super.execute();                                                        
                                                                      

        try
        {
            ScmRepository repository = getScmRepository();                      
                                                                      

            UpdateScmResult result = getScmManager().update( repository, 
getFileSet(),
                                                             getScmVersion( 
scmVersionType, scmVersion ),
                                                             runChangelog );    
                                                                      

            checkResult( result );                                              
                                                                      

            if ( result instanceof UpdateScmResultWithRevision )
            {
                String revision = ( (UpdateScmResultWithRevision) result 
).getRevision();                                                             

                getLog().info( "Storing revision in '" + revisionKey + "' 
project property." );                                                       

                if ( project.getProperties() != null ) // Remove the test when 
we'll use plugin-test-harness 1.0-alpha-2
                {
                    project.getProperties().put( revisionKey, revision );       
                                                                      
                }

                getLog().info( "Project at revision " + revision );             
                                                                      
            }
        }
        catch ( IOException e )
        {
            throw new MojoExecutionException( "Cannot run update command : ", e 
);                                                                    
        }
        catch ( ScmException e )
        {
            throw new MojoExecutionException( "Cannot run update command : ", e 
);                                                                    
        }
    }

The problem must be that the 'revision' String is null. I guess that is a bug 
in the Git SCM provider, but I would argue it is also a bug in the Update mojo, 
which should be a little bit more resistant to null results.

-- 
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


Reply via email to