Author: stefanegli
Date: Wed Jan 27 15:16:57 2016
New Revision: 1727084

URL: http://svn.apache.org/viewvc?rev=1727084&view=rev
Log:
SLING-5458 : id can now be null - return null in getViewId in that case

Modified:
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteDescriptor.java

Modified: 
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteDescriptor.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteDescriptor.java?rev=1727084&r1=1727083&r2=1727084&view=diff
==============================================================================
--- 
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteDescriptor.java
 (original)
+++ 
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteDescriptor.java
 Wed Jan 27 15:16:57 2016
@@ -110,9 +110,14 @@ public class DiscoveryLiteDescriptor {
      * @throws Exception if anything in the descriptor is wrongly formatted
      */
     public String getViewId() throws Exception {
+        if (descriptor.isNull("id")) {
+            // SLING-5458 : id can now be null,
+            // so treat this separately and return null here too
+            return null;
+        }
         Object idObj = descriptor.get("id");
         if (idObj == null || !(idObj instanceof String)) {
-            throw new Exception("getMe: 'me' value of descriptor not a String: 
"+idObj+" (descriptor: "+descriptor+")");
+            throw new Exception("getViewId: 'id' value of descriptor not a 
String: "+idObj+" (descriptor: "+descriptor+")");
         }
         return String.valueOf(idObj);
     }


Reply via email to