incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1542627 - /sling/trunk/contrib/extensions/tenant/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java
Date Sun, 17 Nov 2013 01:24:20 GMT
Author: fmeschbe
Date: Sun Nov 17 01:24:20 2013
New Revision: 1542627

URL: http://svn.apache.org/r1542627
Log:
SLING-3245 Scan all potential path map candidates and don't
abort at first candidate which may not map to a Tenant

Modified:
    sling/trunk/contrib/extensions/tenant/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java

Modified: sling/trunk/contrib/extensions/tenant/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/tenant/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java?rev=1542627&r1=1542626&r2=1542627&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/tenant/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java
(original)
+++ sling/trunk/contrib/extensions/tenant/src/main/java/org/apache/sling/tenant/internal/TenantAdapterFactory.java
Sun Nov 17 01:24:20 2013
@@ -136,16 +136,11 @@ class TenantAdapterFactory implements Ad
 	@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 Ad
                 // 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;
     }
 



Mime
View raw message