diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java b/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java index 8556e62a31..b63a53b0e1 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java @@ -32,19 +32,19 @@ public class DefaultArtifact // These are the only things i need to specify // ---------------------------------------------------------------------- - private String groupId; + private final String groupId; - private String artifactId; + private final String artifactId; - private String version; + private final String version; - private String type; + private final String type; - private String classifier; + private final String classifier; - private String scope; + private final String scope; - private String extension; + private final String extension; private String path; @@ -52,7 +52,7 @@ public class DefaultArtifact * @todo this should be replaced by type handler */ public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type, - String extension ) + String extension ) { this( groupId, artifactId, version, scope, type, null, extension ); } @@ -62,7 +62,7 @@ public class DefaultArtifact * only. Classifier is for specifying derived artifacts, like ejb-client. */ public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type, - String classifier, String extension ) + String classifier, String extension ) { if ( type == null ) { @@ -81,7 +81,14 @@ public class DefaultArtifact this.classifier = classifier; - this.extension = extension; + if ( extension == null ) + { + this.extension = type; + } + else + { + this.extension = extension; + } } public DefaultArtifact( String groupId, String artifactId, String version, String type ) @@ -126,12 +133,7 @@ public class DefaultArtifact public String getExtension() { - if ( extension != null ) - { - return extension; - } - - return type; + return extension; } // ---------------------------------------------------------------------- diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/manager/ArtifactHandlerManager.java b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/manager/ArtifactHandlerManager.java index f104bf2370..af12d8eaae 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/manager/ArtifactHandlerManager.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/manager/ArtifactHandlerManager.java @@ -1,11 +1,7 @@ package org.apache.maven.artifact.handler.manager; -import org.apache.maven.artifact.handler.ArtifactHandler; - -import java.util.Set; - /* - * 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. @@ -20,6 +16,10 @@ import java.util.Set; * limitations under the License. */ +import org.apache.maven.artifact.handler.ArtifactHandler; + +import java.util.Set; + /** * @author Jason van Zyl * @version $Id$ @@ -28,7 +28,8 @@ public interface ArtifactHandlerManager { String ROLE = ArtifactHandlerManager.class.getName(); - ArtifactHandler getArtifactHandler( String type ) throws ArtifactHandlerNotFoundException; + ArtifactHandler getArtifactHandler( String type ) + throws ArtifactHandlerNotFoundException; // String localRepositoryPath( Artifact artifact, ArtifactRepository localRepository ) // throws ArtifactHandlerNotFoundException;