You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by pg...@apache.org on 2009/05/05 23:56:23 UTC
svn commit: r771987 -
/maven/ant-tasks/branches/maven-ant-tasks-2.0.x/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactWithRepositoryTask.java
Author: pgier
Date: Tue May 5 21:56:22 2009
New Revision: 771987
URL: http://svn.apache.org/viewvc?rev=771987&view=rev
Log:
[MANTTASKS-142] A couple improvements to default remote repository id suggested by Benjamin.
Modified:
maven/ant-tasks/branches/maven-ant-tasks-2.0.x/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactWithRepositoryTask.java
Modified: maven/ant-tasks/branches/maven-ant-tasks-2.0.x/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactWithRepositoryTask.java
URL: http://svn.apache.org/viewvc/maven/ant-tasks/branches/maven-ant-tasks-2.0.x/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactWithRepositoryTask.java?rev=771987&r1=771986&r2=771987&view=diff
==============================================================================
--- maven/ant-tasks/branches/maven-ant-tasks-2.0.x/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactWithRepositoryTask.java (original)
+++ maven/ant-tasks/branches/maven-ant-tasks-2.0.x/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactWithRepositoryTask.java Tue May 5 21:56:22 2009
@@ -143,7 +143,9 @@
}
if ( remoteRepository.getId() == null || remoteRepository.getId().equals( remoteRepository.getUrl() ) )
{
- log( "Each remote repository should specify a unique id.", Project.MSG_WARN );
+ log( "Each remote repository must specify a unique id. For backward-compatibility, "
+ + "a default id will be used. In future releases, a missing repository id will raise an error.",
+ Project.MSG_WARN );
remoteRepository.setId( generateDefaultRepositoryId( remoteRepository ) );
}
remoteRepositories.add( remoteRepository );
@@ -151,6 +153,8 @@
public final String MD5_ALGO_NAME = "MD5";
+ public final String UTF_ENC_NAME = "UTF-8";
+
/**
* Generates an MD5 digest based on the url of the repository.
* This is safer to use for the id than the url.
@@ -164,11 +168,11 @@
try
{
MessageDigest md = MessageDigest.getInstance( MD5_ALGO_NAME );
- md.update( repository.getUrl().getBytes() );
+ md.update( repository.getUrl().getBytes( UTF_ENC_NAME ) );
BigInteger digest = new BigInteger( md.digest() );
return digest.toString( 16 );
}
- catch ( NoSuchAlgorithmException e )
+ catch ( Exception e )
{
log( "Unable to generate unique repository Id: " + e, Project.MSG_WARN );
return "default";