Author: olli
Date: Tue Jul 25 08:02:39 2017
New Revision: 1802897

URL: http://svn.apache.org/viewvc?rev=1802897&view=rev
Log:
SLING-7009 NPE in ResourceChangeListenerInfo when resource.change.types is not 
String or String array

catch NPE also and mark config invalid when not String or String array

Modified:
    
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/observation/ResourceChangeListenerInfo.java

Modified: 
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/observation/ResourceChangeListenerInfo.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/observation/ResourceChangeListenerInfo.java?rev=1802897&r1=1802896&r2=1802897&view=diff
==============================================================================
--- 
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/observation/ResourceChangeListenerInfo.java
 (original)
+++ 
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/observation/ResourceChangeListenerInfo.java
 Tue Jul 25 08:02:39 2017
@@ -117,17 +117,17 @@ public class ResourceChangeListenerInfo
         if (ref.getProperty(CHANGES) != null ) {
             final Set<ChangeType> rts = new HashSet<ChangeType>();
             final Set<ChangeType> pts = new HashSet<ChangeType>();
-            for (final String changeName : 
toStringArray(ref.getProperty(CHANGES))) {
-                try {
+            try {
+                for (final String changeName : 
toStringArray(ref.getProperty(CHANGES))) {
                     final ChangeType ct = ChangeType.valueOf(changeName);
-                    if ( ct.ordinal() < ChangeType.PROVIDER_ADDED.ordinal()) {
+                    if (ct.ordinal() < ChangeType.PROVIDER_ADDED.ordinal()) {
                         rts.add(ct);
                     } else {
                         pts.add(ct);
                     }
-                } catch ( final IllegalArgumentException iae) {
-                    configValid = false;
                 }
+            } catch (final Exception e) {
+                configValid = false;
             }
             if ( rts.isEmpty() ) {
                 this.resourceChangeTypes = Collections.emptySet();


Reply via email to