mohiaror commented on a change in pull request #50:
URL: 
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/50#discussion_r735099168



##########
File path: 
src/main/java/org/apache/sling/resourceresolver/impl/mapping/ResourceMapperImpl.java
##########
@@ -72,7 +72,7 @@ public String getMapping(String resourcePath, 
HttpServletRequest request) {
         
         Collection<String> mappings = getAllMappings(resourcePath, request);
         if ( mappings.isEmpty() )
-            return null;
+            return "";

Review comment:
       If we are _always_ adding a path in `mappings`, can there be a case when 
`mappings` collection is `empty`?

##########
File path: 
src/main/java/org/apache/sling/resourceresolver/impl/mapping/ResourceMapperImpl.java
##########
@@ -154,7 +154,7 @@ public String getMapping(String resourcePath, 
HttpServletRequest request) {
         }
 
         // 5. add the requested path itself, if not already populated
-        if ( !mappedPath.isEmpty() && !mappings.contains(mappedPath))
+        if (!mappings.contains(mappedPath))

Review comment:
       I think the order in which is the entries are added in `mappings` array 
is important since `getMappings` API simply returns the first entry of the 
collection. After this change an empty path will be added before the 
`nonDecoratedResource` path. Can you please check if that is acceptable 
behavior when compared with how it was before these changes were added?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to