o merged from r633053 (fixed potential NPE)

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@633054 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vincent Siveton 2008-03-03 12:09:01 +00:00
parent b19a751704
commit 80a6818f01
1 changed files with 15 additions and 7 deletions

View File

@ -53,18 +53,26 @@ public final class CLIReportingUtils
Properties properties = new Properties(); Properties properties = new Properties();
resourceAsStream = MavenCli.class.getClassLoader() resourceAsStream = MavenCli.class.getClassLoader()
.getResourceAsStream( "META-INF/maven/org.apache.maven/maven-core/pom.properties" ); .getResourceAsStream( "META-INF/maven/org.apache.maven/maven-core/pom.properties" );
properties.load( resourceAsStream );
if ( properties.getProperty( "builtOn" ) != null ) if ( resourceAsStream != null )
{ {
System.out.println( "Maven version: " properties.load( resourceAsStream );
+ properties.getProperty( "version", "unknown" ) + " built on "
+ properties.getProperty( "builtOn" ) ); if ( properties.getProperty( "builtOn" ) != null )
{
System.out.println( "Maven version: "
+ properties.getProperty( "version", "unknown" ) + " built on "
+ properties.getProperty( "builtOn" ) );
}
else
{
System.out.println( "Maven version: "
+ properties.getProperty( "version", "unknown" ) );
}
} }
else else
{ {
System.out.println( "Maven version: " System.out.println( "Maven version: unknown" );
+ properties.getProperty( "version", "unknown" ) );
} }
System.out.println( "Java version: " System.out.println( "Java version: "