]> source.dussan.org Git - archiva.git/commitdiff
[MRM-713] extensionPattern in FilenameParser is incorrect
authorBrett Porter <brett@apache.org>
Mon, 25 Feb 2008 11:27:31 +0000 (11:27 +0000)
committerBrett Porter <brett@apache.org>
Mon, 25 Feb 2008 11:27:31 +0000 (11:27 +0000)
Submitted by:    james ahlborn
Merged from: r630811

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches@630813 13f79535-47bb-0310-9956-ffa450edef68

archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java
archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/FilenameParserTest.java

index 18a2b85774c98cc754b8d56659e987898977f2f6..0acea93afc937d3641f4e1d1b7911458a169be27 100644 (file)
@@ -41,7 +41,7 @@ public class FilenameParser
     private static final Pattern mavenPluginPattern = Pattern.compile( "(maven-.*-plugin)|(.*-maven-plugin)" );
 
     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]+)(.*)$" );
 
index f95f367b312b086e5fce8dba059d0bde49595a93..9b31da6317935ead363a20647b1d95f903daddc8 100644 (file)
@@ -179,4 +179,10 @@ public class FilenameParserTest
         assertEquals( "artifact-id-1.0-20070219.171202-34-test-sources", parser.getName() );
         assertEquals( "jar", parser.getExtension() );
     }
+
+    public void testNoExtension()
+    {
+        FilenameParser parser = new FilenameParser( "foo_bar" );
+        assertNull( parser.getExtension() );
+    }
 }