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

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

commit 2dbf317f5d13941532f60e30ba8b53871e3b1d7a
Author: Felix Meschberger <[email protected]>
AuthorDate: Sun Nov 17 01:24:20 2013 +0000

    SLING-3245 Scan all potential path map candidates and don't
    abort at first candidate which may not map to a Tenant
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1542627 
13f79535-47bb-0310-9956-ffa450edef68
---
 .../tenant/internal/TenantAdapterFactory.java      | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java 
b/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java
index 3494615..4048ec4 100644
--- a/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java
+++ b/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java
@@ -136,16 +136,11 @@ class TenantAdapterFactory implements AdapterFactory {
        @SuppressWarnings("unchecked")
        private <AdapterType> AdapterType getAdapter(String path,
                        Class<AdapterType> type) {
-               if (type == TENANT_CLASS) {
-                       Tenant tenant = resolveTenantByPath(path);
-
-                       if (tenant != null) {
-                               return (AdapterType) tenant;
-                       }
-
-               }
-               log.debug("Unable to adapt to resource of type {}", 
type.getName());
-               return null;
+        if (type == TENANT_CLASS) {
+            return (AdapterType) resolveTenantByPath(path);
+        }
+        log.debug("Unable to adapt to resource of type {}", type.getName());
+        return null;
        }
 
     private Tenant resolveTenantByPath(String path) {
@@ -157,10 +152,15 @@ class TenantAdapterFactory implements AdapterFactory {
                 // make group number configurable.
                 if (matcher.groupCount() >= 1) {
                     String tenantId = matcher.group(1);
-                    return this.tenantProvider.getTenant(tenantId);
+                    final Tenant tenant = 
this.tenantProvider.getTenant(tenantId);
+                    if (tenant != null) {
+                        return tenant;
+                    }
                 }
             }
         }
+
+        log.debug("Cannot resolve {} to a Tenant", path);
         return null;
     }
 

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to