maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niclas Hedhman (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SCM-856) use objects as String without calling the toString method
Date Sat, 09 Dec 2017 06:01:00 GMT

    [ https://issues.apache.org/jira/browse/SCM-856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16284615#comment-16284615
] 

Niclas Hedhman commented on SCM-856:
------------------------------------

Additionally, IF the object is 'null' a toString() cause an NPE. And doing Objects.toString(x)
is just so ugly.

> use objects as String without calling the toString method
> ---------------------------------------------------------
>
>                 Key: SCM-856
>                 URL: https://issues.apache.org/jira/browse/SCM-856
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-plugin
>    Affects Versions: 1.9.5
>            Reporter: songwanging
>            Priority: Minor
>
> Our tool DeepTect has detected two buggy code snippets, in which the code prints out
an object without calling the toString method:
> Path: maven-scm/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ExportMojo.java
> {code:java}
> this.exportDirectory = new File( this.getBasedir(), "target/export" );
> ...
> this.getLog().info( "Removing " + this.exportDirectory );
> ...
>  throw new MojoExecutionException( "Cannot create " + this.exportDirectory );
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message