Thanks for your patch Markus. I actually changed the comparator to handle
ArtifactDownloadReport instead of Artifact, since now collections contains
ArtifactDownloadReport. With generics this would have been caught by the
compiler... But we are missing some unit tests for retrieve, there's room
for improvement!

Xavier

On Dec 28, 2007 10:34 PM, Markus M. May <[EMAIL PROTECTED]> wrote:

> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/

Reply via email to