incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1345673 - /sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/SortingServiceTracker.java
Date Sun, 03 Jun 2012 13:48:46 GMT
Author: cziegeler
Date: Sun Jun  3 13:48:45 2012
New Revision: 1345673

URL: http://svn.apache.org/viewvc?rev=1345673&view=rev
Log:
SLING-2500 : NPE in SortingServiceTracker#getSortedServices

Modified:
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/SortingServiceTracker.java

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/SortingServiceTracker.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/SortingServiceTracker.java?rev=1345673&r1=1345672&r2=1345673&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/SortingServiceTracker.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/SortingServiceTracker.java
Sun Jun  3 13:48:45 2012
@@ -118,19 +118,21 @@ public class SortingServiceTracker<T>
      * Return a sorted list of the services references.
      */
     public List<ServiceReference> getSortedServiceReferences() {
+        List<ServiceReference> result = this.sortedReferences;
         if ( this.sortedReferences == null || this.lastRefCount < this.getTrackingCount()
) {
             this.lastRefCount = this.getTrackingCount();
             final ServiceReference[] references = this.getServiceReferences();
             if ( references == null || references.length == 0 ) {
-                this.sortedReferences = Collections.emptyList();
+                result = Collections.emptyList();
             } else {
                 Arrays.sort(references);
-                this.sortedReferences = new ArrayList<ServiceReference>();
+                result = new ArrayList<ServiceReference>();
                 for(int i=0;i<references.length;i++) {
-                    this.sortedReferences.add(references[references.length - 1 - i]);
+                    result.add(references[references.length - 1 - i]);
                 }
             }
+            this.sortedReferences = result;
         }
-        return this.sortedReferences;
+        return result;
     }
 }



Mime
View raw message