You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2008/11/26 23:51:18 UTC

svn commit: r721019 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/plugins/resolver/BasicResolver.java src/java/org/apache/ivy/util/ChecksumHelper.java

Author: maartenc
Date: Wed Nov 26 14:51:18 2008
New Revision: 721019

URL: http://svn.apache.org/viewvc?rev=721019&view=rev
Log:
- IMPROVEMENT: Error message is not clear when specifying an invalid value for checksums (IVY-977)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=721019&r1=721018&r2=721019&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Wed Nov 26 14:51:18 2008
@@ -85,6 +85,7 @@
 =====================================
 - IMPROVEMENT: Support useOrigin for artifacts with a set url attribute (IVY-965) (thanks to alex322)
 - IMPROVEMENT: Ivy Standalone setting to overwrite publications (IVY-976)
+- IMPROVEMENT: Error message is not clear when specifying an invalid value for checksums (IVY-977)
 
 - FIX: Log levels aren't respected in certain cases using the standalone functionality (IVY-960) (thanks to Patrick Woodworth)
 - FIX: Listing of URL's under a given URL does not handle fully specified URL's (IVY-959) (thanks to Randy Nott)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java?rev=721019&r1=721018&r2=721019&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java Wed Nov 26 14:51:18 2008
@@ -890,6 +890,10 @@
      *             if a checksum exist but do not match the downloaded file checksum
      */
     private boolean check(Resource resource, File dest, String algorithm) throws IOException {
+        if (!ChecksumHelper.isKnownAlgorithm(algorithm)) {
+            throw new IllegalArgumentException("Unknown checksum algorithm: " + algorithm);
+        }
+        
         Resource csRes = resource.clone(resource.getName() + "." + algorithm);
         if (csRes.exists()) {
             Message.debug(algorithm + " file found for " + resource + ": checking...");

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java?rev=721019&r1=721018&r2=721019&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java Wed Nov 26 14:51:18 2008
@@ -91,6 +91,10 @@
         }
     }
 
+    public static boolean isKnownAlgorithm(String algorithm) {
+        return algorithms.containsKey(algorithm);
+    }
+    
     private static MessageDigest getMessageDigest(String algorithm) {
         String mdAlgorithm = (String) algorithms.get(algorithm);
         if (mdAlgorithm == null) {