handle invalid format file

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163730 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-03-31 11:31:12 +00:00
parent 13f95996f1
commit a185b72aeb
1 changed files with 2 additions and 2 deletions

View File

@ -169,14 +169,14 @@ public class SnapshotArtifactMetadata
String version = FileUtils.fileRead( file );
lastModified = file.lastModified();
if ( version.indexOf( "SNAPSHOT" ) >= 0 )
int index = version.lastIndexOf( "-" );
if ( version.indexOf( "SNAPSHOT" ) >= 0 || index < 0 )
{
timestamp = null;
buildNumber = 0;
return;
}
int index = version.lastIndexOf( "-" );
timestamp = version.substring( 0, index );
buildNumber = Integer.valueOf( version.substring( index + 1 ) ).intValue();
index = timestamp.lastIndexOf( "-" );