]> source.dussan.org Git - archiva.git/commitdiff
[MRM-731] fix failure introduced by previous commit
authorBrett Porter <brett@apache.org>
Mon, 25 Feb 2008 13:48:47 +0000 (13:48 +0000)
committerBrett Porter <brett@apache.org>
Mon, 25 Feb 2008 13:48:47 +0000 (13:48 +0000)
Merged from: r630844, 630842

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

archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java
archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java

index 699f913527d886d7d505ef05b9017224f41e3670..3c28cec2c110040370f87f4eb946d8f57822fc09 100644 (file)
@@ -93,15 +93,15 @@ public class ArtifactExtensionMapping
 
     public static String mapExtensionToType( String extension )
     {
-        if ( extension.equals( "tar.gz" ) )
+        if ( "tar.gz".equals( extension ) )
         {
             return "distribution-tgz";
         }
-        else  if ( extension.equals( "tar.bz2" ) )
+        else  if ( "tar.bz2".equals( extension ) )
         {
             return "distribution-bzip";
         }
-        else  if ( extension.equals( "zip" ) )
+        else  if ( "zip".equals( extension ) )
         {
             return "distribution-zip";
         }
index c123f5734c4fd8442d29634e4b0617f0de35fafd..e43bf073f1550cf5aeac16064c90785e9d5a2bc5 100644 (file)
@@ -156,7 +156,12 @@ public class DefaultPathParser implements PathParser
                     break;
                 case 0:
                     // End of the filename, only a simple extension left. - Set the type.
-                    artifact.setType( ArtifactExtensionMapping.mapExtensionToType( parser.getExtension() ) );
+                    String type = ArtifactExtensionMapping.mapExtensionToType( parser.getExtension() );
+                    if ( type == null )
+                    {
+                        throw new LayoutException( "Invalid artifact: no type was specified" );
+                    }
+                    artifact.setType( type );
                     break;
             }