Uploaded image for project: 'Maven SCM'
  1. Maven SCM
  2. SCM-441

NPE when using Git SCM 1.2-SNAPSHOT

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2
    • 1.2
    • None
    • Linux and MacOSX, probably everywhere

    Description

      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.

      Attachments

        1. SCM-441.patch
          16 kB
          Mark Struberg

        Activity

          People

            olamy Olivier Lamy
            petterm Petter Måhlén
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: