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 class DefaultRepositoryLayout
}
catch ( ArtifactHandlerNotFoundException e )
{
throw new ArtifactPathFormatException( "Cannot find ArtifactHandler for artifact: \'" + artifact.getId()
+ "\'.", e );
throw new ArtifactPathFormatException( "Cannot find ArtifactHandler for artifact: \'" + artifact.getId() +
"\'.", e );
}
StringBuffer path = new StringBuffer();
@ -58,7 +58,10 @@ public class DefaultRepositoryLayout
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();
}

View File

@ -42,22 +42,25 @@ public class LegacyRepositoryLayout
}
catch ( ArtifactHandlerNotFoundException e )
{
throw new ArtifactPathFormatException( "Cannot find ArtifactHandler for artifact: \'" + artifact.getId()
+ "\'.", e );
throw new ArtifactPathFormatException( "Cannot find ArtifactHandler for artifact: \'" + artifact.getId() +
"\'.", e );
}
StringBuffer path = new StringBuffer();
path.append(artifact.getGroupId()).append('/');
path.append(artifactHandler.directory()).append('/');
path.append(artifact.getArtifactId()).append('-').append(artifact.getVersion());
path.append( artifact.getGroupId() ).append( '/' );
path.append( artifactHandler.directory() ).append( '/' );
path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
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();
}
@ -66,12 +69,12 @@ public class LegacyRepositoryLayout
throws ArtifactPathFormatException
{
Artifact artifact = metadata.getArtifact();
StringBuffer path = new StringBuffer();
path.append(artifact.getGroupId()).append("/poms/");
path.append(metadata.getFilename());
path.append( artifact.getGroupId() ).append( "/poms/" );
path.append( metadata.getFilename() );
return path.toString();
}