Author: fmeschbe
Date: Sun Dec 20 21:11:42 2009
New Revision: 892661
URL: http://svn.apache.org/viewvc?rev=892661&view=rev
Log:
SLING-1218 Ensure accessing "root" ("/") does not cause a NPE in the URI class
when accessing the path.
Modified:
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Modified:
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java?rev=892661&r1=892660&r2=892661&view=diff
==============================================================================
---
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
(original)
+++
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Sun Dec 20 21:11:42 2009
@@ -322,9 +322,15 @@
// build path from segment names
StringBuilder buf = new StringBuilder();
- while (!names.isEmpty()) {
+
+ // construct the path from the segments (or root if none)
+ if (names.isEmpty()) {
buf.append('/');
- buf.append(names.removeLast());
+ } else {
+ while (!names.isEmpty()) {
+ buf.append('/');
+ buf.append(names.removeLast());
+ }
}
// reappend the resolutionPathInfo