[
https://issues.apache.org/jira/browse/SCM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17961585#comment-17961585
]
ASF GitHub Bot commented on SCM-441:
------------------------------------
jira-importer opened a new issue, #664:
URL: https://github.com/apache/maven-scm/issues/664
**[Petter
Måhlén](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=petterm)**
opened
**[SCM-441](https://issues.apache.org/jira/browse/SCM-441?redirect=false)** and
commented
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.
---
**Affects:** 1.2
**Attachments:**
-
[SCM-441.patch](https://issues.apache.org/jira/secure/attachment/12718708/SCM-441.patch)
(_15.88 kB_)
> NPE when using Git SCM 1.2-SNAPSHOT
> -----------------------------------
>
> Key: SCM-441
> URL: https://issues.apache.org/jira/browse/SCM-441
> Project: Maven SCM (Moved to GitHub Issues)
> Issue Type: Bug
> Components: maven-scm-provider-gitexe
> Affects Versions: 1.2
> Environment: Linux and MacOSX, probably everywhere
> Reporter: Petter Måhlén
> Assignee: Olivier Lamy
> Priority: Major
> Fix For: 1.2
>
> Attachments: SCM-441.patch
>
>
> 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 was sent by Atlassian Jira
(v8.20.10#820010)