You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:27:00 UTC

[sling-org-apache-sling-discovery-commons] 18/24: SLING-5458 : id can now be null - return null in getViewId in that case

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.discovery.commons-1.0.10
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-discovery-commons.git

commit 8cb48674e6e0e8589b93807ecf5785dd131098e5
Author: Stefan Egli <st...@apache.org>
AuthorDate: Wed Jan 27 15:16:57 2016 +0000

    SLING-5458 : id can now be null - return null in getViewId in that case
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/discovery/commons@1727084 13f79535-47bb-0310-9956-ffa450edef68
---
 .../commons/providers/spi/base/DiscoveryLiteDescriptor.java        | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteDescriptor.java b/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteDescriptor.java
index 906ab27..9ec862d 100644
--- a/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteDescriptor.java
+++ b/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteDescriptor.java
@@ -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);
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.