allow an empty extension

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163890 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-04-11 01:24:43 +00:00
parent 08eaf5c94f
commit cd9f2972af
2 changed files with 25 additions and 19 deletions

View File

@ -42,8 +42,8 @@ public String pathOf( Artifact artifact )
} }
catch ( ArtifactHandlerNotFoundException e ) catch ( ArtifactHandlerNotFoundException e )
{ {
throw new ArtifactPathFormatException( "Cannot find ArtifactHandler for artifact: \'" + artifact.getId() throw new ArtifactPathFormatException( "Cannot find ArtifactHandler for artifact: \'" + artifact.getId() +
+ "\'.", e ); "\'.", e );
} }
StringBuffer path = new StringBuffer(); StringBuffer path = new StringBuffer();
@ -58,7 +58,10 @@ public String pathOf( Artifact artifact )
path.append( '-' ).append( artifact.getClassifier() ); path.append( '-' ).append( artifact.getClassifier() );
} }
path.append( '.' ).append( artifactHandler.extension() ); if ( artifactHandler.extension() != null && artifactHandler.extension().length() > 0 )
{
path.append( '.' ).append( artifactHandler.extension() );
}
return path.toString(); return path.toString();
} }

View File

@ -42,22 +42,25 @@ public String pathOf( Artifact artifact )
} }
catch ( ArtifactHandlerNotFoundException e ) catch ( ArtifactHandlerNotFoundException e )
{ {
throw new ArtifactPathFormatException( "Cannot find ArtifactHandler for artifact: \'" + artifact.getId() throw new ArtifactPathFormatException( "Cannot find ArtifactHandler for artifact: \'" + artifact.getId() +
+ "\'.", e ); "\'.", e );
} }
StringBuffer path = new StringBuffer(); StringBuffer path = new StringBuffer();
path.append(artifact.getGroupId()).append('/'); path.append( artifact.getGroupId() ).append( '/' );
path.append(artifactHandler.directory()).append('/'); path.append( artifactHandler.directory() ).append( '/' );
path.append(artifact.getArtifactId()).append('-').append(artifact.getVersion()); path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
if ( artifact.hasClassifier() ) if ( artifact.hasClassifier() )
{ {
path.append('-').append(artifact.getClassifier()); path.append( '-' ).append( artifact.getClassifier() );
}
if ( artifactHandler.extension() != null && artifactHandler.extension().length() > 0 )
{
path.append( '.' ).append( artifactHandler.extension() );
} }
path.append('.').append(artifactHandler.extension());
return path.toString(); return path.toString();
} }
@ -66,12 +69,12 @@ public String pathOfMetadata( ArtifactMetadata metadata )
throws ArtifactPathFormatException throws ArtifactPathFormatException
{ {
Artifact artifact = metadata.getArtifact(); Artifact artifact = metadata.getArtifact();
StringBuffer path = new StringBuffer(); StringBuffer path = new StringBuffer();
path.append(artifact.getGroupId()).append("/poms/"); path.append( artifact.getGroupId() ).append( "/poms/" );
path.append(metadata.getFilename()); path.append( metadata.getFilename() );
return path.toString(); return path.toString();
} }