You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/02/07 11:28:39 UTC

svn commit: r375567 - /lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/SiteProxy.java

Author: andreas
Date: Tue Feb  7 02:28:37 2006
New Revision: 375567

URL: http://svn.apache.org/viewcvs?rev=375567&view=rev
Log:
SiteProxy.getNode(): Throw exception if site node path is not absolute

Modified:
    lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/SiteProxy.java

Modified: lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/SiteProxy.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/SiteProxy.java?rev=375567&r1=375566&r2=375567&view=diff
==============================================================================
--- lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/SiteProxy.java (original)
+++ lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/SiteProxy.java Tue Feb  7 02:28:37 2006
@@ -72,7 +72,12 @@
     }
 
     public SiteNode getNode(String path) throws RepositoryException {
-        String[] snippets = path.split("/");
+
+        if (!path.startsWith("/")) {
+            throw new RepositoryException("The path [" + path + "] doesn't start with a slash!");
+        }
+
+        String[] snippets = path.substring(1).split("/");
         PathElement[] elements = new PathElement[snippets.length];
         for (int i = 0; i < elements.length; i++) {
             elements[i] = new NamePathElement(snippets[i]);
@@ -132,8 +137,7 @@
         SiteNode[] nodes = getReferences(asset);
         if (nodes.length > 0) {
             return nodes[0];
-        }
-        else {
+        } else {
             return null;
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org