You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "K. Rekk (JIRA)" <ji...@apache.org> on 2009/01/06 18:12:44 UTC

[jira] Created: (IVY-993) latest-time strategy not compatible with version ranges in transitiv dependencies

latest-time strategy not compatible with version ranges in transitiv dependencies
---------------------------------------------------------------------------------

                 Key: IVY-993
                 URL: https://issues.apache.org/jira/browse/IVY-993
             Project: Ivy
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.0-RC2
         Environment: kubuntu 8.04, java 1.6, ant 1.7
            Reporter: K. Rekk


Using latest-time as defaultLatestStrategy="latest-time" would give errors on first level transitiv dependency. Default strategy would do fine. It seems to be a similar problem as in https://issues.apache.org/jira/browse/IVY-966 .

The ivy.xml of direct dependency to retrieve has:
    <dependencies>
        <dependency org="javax.mail" name="javamail" rev="[1.4,2.0[" conf="mail-&gt;default"/>
        <dependency org="javax.jms" name="jms" rev="[1.1,2.0[" conf="jms-&gt;default"/>
        <dependency org="javax.management" name="jmx" rev="[1.2.1,2.0[" conf="jmx-&gt;default,tools"/>

    </dependencies>

Although I am far away from understanding what exactly is going on (some further developer docs would be great), here my observations:

Watching debug shows that all this boils down to call :

public class LatestTimeStrategy extends ComparatorLatestStrategy {
    private static final Comparator COMPARATOR = new Comparator() {
        public int compare(Object o1, Object o2) {
            long d1 = ((ArtifactInfo) o1).getLastModified();
            long d2 = ((ArtifactInfo) o2).getLastModified();
            return new Long(d1).compareTo(new Long(d2));
        }

to try compare Infos for 1.2.1 and 2.0  for <dependency org="javax.management" name="jmx" rev="[1.2.1,2.0[" conf="jmx-&gt;default,tools"/> . But getLastModified will give 0. So sorting will fail.

This interesting thing starts from VersionRangeMatcher

    private boolean isLower(ModuleRevisionId askedMrid, String revision,
            ModuleRevisionId foundMrid, boolean inclusive) {
        ModuleRevisionId mRevId = ModuleRevisionId.newInstance(askedMrid, revision);
        int result = comparator.compare(mRevId, foundMrid);        
        return result <= (inclusive ? 0 : -1);
    }

with 

foundMrid javax.management#jmx;1.2.1
mRevId javax.management#jmx;2.0

Also it would be nice to have some tests for org.apache.ivy.plugins.latest.LatestTimeStrategy .



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (IVY-993) latest-time strategy not compatible with version ranges in transitiv dependencies

Posted by "K. Rekk (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IVY-993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

K. Rekk updated IVY-993:
------------------------

    Attachment: ivy-latest-time.zip

two modified hello-ivy tutorial projects one using packager the other normal repository with debug logs to isolate the issue

> latest-time strategy not compatible with version ranges in transitiv dependencies
> ---------------------------------------------------------------------------------
>
>                 Key: IVY-993
>                 URL: https://issues.apache.org/jira/browse/IVY-993
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0-RC2
>         Environment: kubuntu 8.04, java 1.6, ant 1.7
>            Reporter: K. Rekk
>         Attachments: ivy-latest-time.zip
>
>
> Using latest-time as defaultLatestStrategy="latest-time" would give errors on first level transitiv dependency. Default strategy would do fine. It seems to be a similar problem as in https://issues.apache.org/jira/browse/IVY-966 .
> The ivy.xml of direct dependency to retrieve has:
>     <dependencies>
>         <dependency org="javax.mail" name="javamail" rev="[1.4,2.0[" conf="mail-&gt;default"/>
>         <dependency org="javax.jms" name="jms" rev="[1.1,2.0[" conf="jms-&gt;default"/>
>         <dependency org="javax.management" name="jmx" rev="[1.2.1,2.0[" conf="jmx-&gt;default,tools"/>
>     </dependencies>
> Although I am far away from understanding what exactly is going on (some further developer docs would be great), here my observations:
> Watching debug shows that all this boils down to call :
> public class LatestTimeStrategy extends ComparatorLatestStrategy {
>     private static final Comparator COMPARATOR = new Comparator() {
>         public int compare(Object o1, Object o2) {
>             long d1 = ((ArtifactInfo) o1).getLastModified();
>             long d2 = ((ArtifactInfo) o2).getLastModified();
>             return new Long(d1).compareTo(new Long(d2));
>         }
> to try compare Infos for 1.2.1 and 2.0  for <dependency org="javax.management" name="jmx" rev="[1.2.1,2.0[" conf="jmx-&gt;default,tools"/> . But getLastModified will give 0. So sorting will fail.
> This interesting thing starts from VersionRangeMatcher
>     private boolean isLower(ModuleRevisionId askedMrid, String revision,
>             ModuleRevisionId foundMrid, boolean inclusive) {
>         ModuleRevisionId mRevId = ModuleRevisionId.newInstance(askedMrid, revision);
>         int result = comparator.compare(mRevId, foundMrid);        
>         return result <= (inclusive ? 0 : -1);
>     }
> with 
> foundMrid javax.management#jmx;1.2.1
> mRevId javax.management#jmx;2.0
> Also it would be nice to have some tests for org.apache.ivy.plugins.latest.LatestTimeStrategy .

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.