You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2012/06/03 15:48:46 UTC
svn commit: r1345673 -
/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/SortingServiceTracker.java
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;
}
}