sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r654433 - /incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java
Date Thu, 08 May 2008 07:16:44 GMT
Author: fmeschbe
Date: Thu May  8 00:16:43 2008
New Revision: 654433

URL: http://svn.apache.org/viewvc?rev=654433&view=rev
Log:
Ensure all entries in the search path set are terminated with a trailing slash
and return a copy of the search path on access to comply with the API spec for
the ResourceResolver.getSearchPath() method.

Modified:
    incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java

Modified: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java?rev=654433&r1=654432&r2=654433&view=diff
==============================================================================
--- incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java
(original)
+++ incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java
Thu May  8 00:16:43 2008
@@ -72,8 +72,7 @@
     }
 
     public String[] getSearchPath() {
-        // noinspection ReturnOfCollectionOrArrayField
-        return searchPath;
+        return searchPath.clone();
 
     }
 
@@ -139,6 +138,13 @@
     }
 
     public void setSearchPath(String... searchPath) {
-        this.searchPath = searchPath;
+        this.searchPath = new String[searchPath.length];
+        for (int i=0; i < searchPath.length; i++) {
+            String entry = searchPath[i];
+            if (!entry.endsWith("/")) {
+                entry = entry.concat("/");
+            }
+            this.searchPath[i] = entry; 
+        }
     }
 }



Mime
View raw message