Author: fmeschbe
Date: Mon Aug 9 11:17:12 2010
New Revision: 983586
URL: http://svn.apache.org/viewvc?rev=983586&view=rev
Log:
SLING-1633 Don't set field to null; otherwise NullPointerExceptions occurr
after unregistration of last tracked ResourceDecorator (thanks Davide Mestroni
reporting and proposing the fix)
Modified:
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/ResourceDecoratorTracker.java
Modified:
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/ResourceDecoratorTracker.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/ResourceDecoratorTracker.java?rev=983586&r1=983585&r2=983586&view=diff
==============================================================================
---
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/ResourceDecoratorTracker.java
(original)
+++
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/ResourceDecoratorTracker.java
Mon Aug 9 11:17:12 2010
@@ -107,7 +107,7 @@ public class ResourceDecoratorTracker {
* called from a synchronized block.
*/
protected void updateResourceDecoratorsArray() {
- ResourceDecorator[] decorators = null;
+ final ResourceDecorator[] decorators;
if (this.resourceDecorators.size() > 0) {
decorators = new ResourceDecorator[this.resourceDecorators.size()];
int index = 0;
@@ -116,6 +116,8 @@ public class ResourceDecoratorTracker {
decorators[index] = i.next().decorator;
index++;
}
+ } else {
+ decorators = EMPTY_ARRAY;
}
this.resourceDecoratorsArray = decorators;
}