ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xavier Hanin" <xavier.ha...@gmail.com>
Subject Re: Re: Ivy trunk doesn't compile
Date Sat, 29 Dec 2007 11:02:17 GMT
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 <mmay@gmx.net> 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: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>


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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message