You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ev...@apache.org on 2005/04/05 23:29:57 UTC

svn commit: r160226 - maven/maven-1/core/trunk/src/java/org/apache/maven/repository/AbstractArtifact.java

Author: evenisse
Date: Tue Apr  5 14:29:56 2005
New Revision: 160226

URL: http://svn.apache.org/viewcvs?view=rev&rev=160226
Log:
Fix NullPointerException when version isn't define.

Modified:
    maven/maven-1/core/trunk/src/java/org/apache/maven/repository/AbstractArtifact.java

Modified: maven/maven-1/core/trunk/src/java/org/apache/maven/repository/AbstractArtifact.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/core/trunk/src/java/org/apache/maven/repository/AbstractArtifact.java?view=diff&r1=160225&r2=160226
==============================================================================
--- maven/maven-1/core/trunk/src/java/org/apache/maven/repository/AbstractArtifact.java (original)
+++ maven/maven-1/core/trunk/src/java/org/apache/maven/repository/AbstractArtifact.java Tue Apr  5 14:29:56 2005
@@ -1,7 +1,7 @@
 package org.apache.maven.repository;
 
 /* ====================================================================
- *   Copyright 2001-2004 The Apache Software Foundation.
+ *   Copyright 2001-2005 The Apache Software Foundation.
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -130,8 +130,15 @@
     /** @see Artifact#isSnapshot */
     public boolean isSnapshot()
     {
-        return getDependency().getVersion().indexOf( MavenConstants.SNAPSHOT_SIGNIFIER ) > 0 ||
-            getDependency().getArtifact().indexOf( MavenConstants.SNAPSHOT_SIGNIFIER ) > 0;
+        if ( getDependency().getVersion() != null )
+        {
+            return getDependency().getVersion().indexOf( MavenConstants.SNAPSHOT_SIGNIFIER ) > 0 ||
+                getDependency().getArtifact().indexOf( MavenConstants.SNAPSHOT_SIGNIFIER ) > 0;
+        }
+        else
+        {
+            return false;
+        }
     }
 
     /** @see Artifact#getFile */



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org