felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r745581 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
Date Wed, 18 Feb 2009 17:27:51 GMT
Author: rickhall
Date: Wed Feb 18 17:27:51 2009
New Revision: 745581

URL: http://svn.apache.org/viewvc?rev=745581&view=rev
Log:
Modified service reference comparison to check whether rank is an Integer and
if not set the rank to zero. (FELIX-948)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java?rev=745581&r1=745580&r2=745581&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
Wed Feb 18 17:27:51 2009
@@ -461,12 +461,18 @@
                 return 0; // same service
             }
 
-            Integer rank = (Integer) getProperty(Constants.SERVICE_RANKING);
-            Integer otherRank = (Integer) other.getProperty(Constants.SERVICE_RANKING);
+            Object rankObj = (Integer) getProperty(Constants.SERVICE_RANKING);
+            Object otherRankObj = (Integer) other.getProperty(Constants.SERVICE_RANKING);
 
             // If no rank, then spec says it defaults to zero.
-            rank = (rank == null) ? new Integer(0) : rank;
-            otherRank = (otherRank == null) ? new Integer(0) : otherRank;
+            rankObj = (rankObj == null) ? new Integer(0) : rankObj;
+            otherRankObj = (otherRankObj == null) ? new Integer(0) : otherRankObj;
+
+            // If rank is not Integer, then spec says it defaults to zero.
+            Integer rank = (rankObj instanceof Integer)
+                ? new Integer(0) : (Integer) rankObj;
+            Integer otherRank = (otherRankObj instanceof Integer)
+                ? new Integer(0) : (Integer) otherRankObj;
 
             // Sort by rank in ascending order.
             if (rank.compareTo(otherRank) < 0)



Mime
View raw message