[MRM-713] extensionPattern in FilenameParser is incorrect

Submitted by:  	 james ahlborn

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@630811 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2008-02-25 11:23:28 +00:00
parent 5673a34dbe
commit e61bcfea4c
2 changed files with 7 additions and 1 deletions

View File

@ -41,7 +41,7 @@ public class FilenameParser
private static final Pattern mavenPluginPattern = Pattern.compile( "(maven-.*-plugin)|(.*-maven-plugin)" ); private static final Pattern mavenPluginPattern = Pattern.compile( "(maven-.*-plugin)|(.*-maven-plugin)" );
private static final Pattern extensionPattern = private static final Pattern extensionPattern =
Pattern.compile( "(.tar.gz$)|(.tar.bz2$)|(.[a-z0-9]*$)", Pattern.CASE_INSENSITIVE ); Pattern.compile( "(\\.tar\\.gz$)|(\\.tar\\.bz2$)|(\\.[a-z0-9]*$)", Pattern.CASE_INSENSITIVE );
private static final Pattern SNAPSHOT_PATTERN = Pattern.compile( "^([0-9]{8}\\.[0-9]{6}-[0-9]+)(.*)$" ); private static final Pattern SNAPSHOT_PATTERN = Pattern.compile( "^([0-9]{8}\\.[0-9]{6}-[0-9]+)(.*)$" );

View File

@ -179,4 +179,10 @@ public class FilenameParserTest
assertEquals( "artifact-id-1.0-20070219.171202-34-test-sources", parser.getName() ); assertEquals( "artifact-id-1.0-20070219.171202-34-test-sources", parser.getName() );
assertEquals( "jar", parser.getExtension() ); assertEquals( "jar", parser.getExtension() );
} }
public void testNoExtension()
{
FilenameParser parser = new FilenameParser( "foo_bar" );
assertNull( parser.getExtension() );
}
} }