You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Stuart McCulloch (JIRA)" <ji...@apache.org> on 2008/11/01 15:59:44 UTC

[jira] Created: (FELIX-799) ServiceReferenceImpl does not support the compareTo() method

ServiceReferenceImpl does not support the compareTo() method
------------------------------------------------------------

                 Key: FELIX-799
                 URL: https://issues.apache.org/jira/browse/FELIX-799
             Project: Felix
          Issue Type: Bug
          Components: Framework, Specification compliance
    Affects Versions: felix-1.2.2
            Reporter: Stuart McCulloch
             Fix For: felix-1.4.0


The current ServiceReferenceImpl does not support the compareTo() method, introduced in release 4.1 of the OSGi spec:

   http://www.osgi.org/javadoc/r4v41/org/osgi/framework/ServiceReference.html#compareTo(java.lang.Object)

I'm also going to link to the general contract for compareTo() in the Java spec, as it explains what happens when comparing against different types:

   http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Comparable.html#compareTo(java.lang.Object)

I'll attach an initial patch which should work according to the spec, although I have not tested it thoroughly.

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


[jira] Closed: (FELIX-799) ServiceReferenceImpl does not support the compareTo() method

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

Stuart McCulloch closed FELIX-799.
----------------------------------


Tested and it works great - closing issue.

> ServiceReferenceImpl does not support the compareTo() method
> ------------------------------------------------------------
>
>                 Key: FELIX-799
>                 URL: https://issues.apache.org/jira/browse/FELIX-799
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework, Specification compliance
>    Affects Versions: felix-1.2.2
>            Reporter: Stuart McCulloch
>            Assignee: Richard S. Hall
>             Fix For: felix-1.4.0
>
>         Attachments: FELIX-799.txt
>
>
> The current ServiceReferenceImpl does not support the compareTo() method, introduced in release 4.1 of the OSGi spec:
>    http://www.osgi.org/javadoc/r4v41/org/osgi/framework/ServiceReference.html#compareTo(java.lang.Object)
> I'm also going to link to the general contract for compareTo() in the Java spec, as it explains what happens when comparing against different types:
>    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Comparable.html#compareTo(java.lang.Object)
> I'll attach an initial patch which should work according to the spec, although I have not tested it thoroughly.

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


[jira] Updated: (FELIX-799) ServiceReferenceImpl does not support the compareTo() method

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

Stuart McCulloch updated FELIX-799:
-----------------------------------

    Attachment: FELIX-799.txt

This patch follows the algorithm specified in the R4.1 OSGi javadoc, and uses a utility method to convert number based properties to longs for simpler comparison (because service.id is defined as a Long, but service.ranking is an Integer).

> ServiceReferenceImpl does not support the compareTo() method
> ------------------------------------------------------------
>
>                 Key: FELIX-799
>                 URL: https://issues.apache.org/jira/browse/FELIX-799
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework, Specification compliance
>    Affects Versions: felix-1.2.2
>            Reporter: Stuart McCulloch
>             Fix For: felix-1.4.0
>
>         Attachments: FELIX-799.txt
>
>
> The current ServiceReferenceImpl does not support the compareTo() method, introduced in release 4.1 of the OSGi spec:
>    http://www.osgi.org/javadoc/r4v41/org/osgi/framework/ServiceReference.html#compareTo(java.lang.Object)
> I'm also going to link to the general contract for compareTo() in the Java spec, as it explains what happens when comparing against different types:
>    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Comparable.html#compareTo(java.lang.Object)
> I'll attach an initial patch which should work according to the spec, although I have not tested it thoroughly.

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


[jira] Resolved: (FELIX-799) ServiceReferenceImpl does not support the compareTo() method

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-799?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard S. Hall resolved FELIX-799.
-----------------------------------

    Resolution: Fixed
      Assignee: Richard S. Hall

I applied the patch, but (perhaps for personal preference reasons) I didn't see the need for the utility method, so I just pulled that functionality up into the compareTo() method. I also modified BundleContextImpl.getBestServiceReference() to use the ServiceReference.compareTo() method rather than duplicate the functionality. I ran it through the TCK and everything appears to be ok. Thanks for the patch Stuart. Please close this issue if you are satisfied with the result.

> ServiceReferenceImpl does not support the compareTo() method
> ------------------------------------------------------------
>
>                 Key: FELIX-799
>                 URL: https://issues.apache.org/jira/browse/FELIX-799
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework, Specification compliance
>    Affects Versions: felix-1.2.2
>            Reporter: Stuart McCulloch
>            Assignee: Richard S. Hall
>             Fix For: felix-1.4.0
>
>         Attachments: FELIX-799.txt
>
>
> The current ServiceReferenceImpl does not support the compareTo() method, introduced in release 4.1 of the OSGi spec:
>    http://www.osgi.org/javadoc/r4v41/org/osgi/framework/ServiceReference.html#compareTo(java.lang.Object)
> I'm also going to link to the general contract for compareTo() in the Java spec, as it explains what happens when comparing against different types:
>    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Comparable.html#compareTo(java.lang.Object)
> I'll attach an initial patch which should work according to the spec, although I have not tested it thoroughly.

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