FELIX-4616 : BundleRepository ResourceComparator violates comparison contract

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1620867 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/ResourceComparator.java b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/ResourceComparator.java
index 35f7439..2dfc892 100644
--- a/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/ResourceComparator.java
+++ b/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/ResourceComparator.java
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -28,10 +28,14 @@
     {
         Resource r1 = (Resource) o1;
         Resource r2 = (Resource) o2;
-        String name1 = (String) r1.getPresentationName();
-        String name2 = (String) r2.getPresentationName();
+        String name1 = r1.getPresentationName();
+        String name2 = r2.getPresentationName();
         if (name1 == null)
         {
+            if (name2 == null)
+            {
+                return 0;
+            }
             return -1;
         }
         else if (name2 == null)