ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus M. May" <m...@gmx.net>
Subject Fwd: Re: Ivy trunk doesn't compile
Date Fri, 28 Dec 2007 21:34:50 GMT
Hello,
I just created a small diff to fix this problem.

R,

Markus

Index: src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
===================================================================
---
src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java	(Revision
607324)
+++ src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java	(Arbeitskopie)
@@ -353,8 +353,28 @@
            return new Comparator() {
                // younger conflict resolving policy
                public int compare(Object o1, Object o2) {
-                Artifact a1 = (Artifact) o1;
-                Artifact a2 = (Artifact) o2;
+                Artifact a1 = null;
+                Artifact a2 = null;
+
+                try {
+                    a1 = (Artifact) o1;
+                    a2 = (Artifact) o2;
+                } catch (ClassCastException ccex) {
+                    Message.error("ClassCastException in
org.apache.ivy.core.retrieve.RetrieveEngine" + ccex.getMessage());
+                }
+
+		if ((a1 == null) && (a2 == null)) {
+                    return 0;
+                }
+
+		if ((a1 != null) && (a2 == null)) {
+                    return 1;
+                }
+
+		if ((a1 == null) && (a2 != null)) {
+		    return -1;
+                }
+
                    if
(a1.getPublicationDate().after(a2.getPublicationDate())) {
                        // a1 is after a2 <=> a1 is younger than a2 <=>
a1 wins the conflict battle
                        return +1;



----- Ende der weitergeleiteten Nachricht -----


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message