svn commit: r656568 - /lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/Link.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Thu May 15 02:27:13 2008
New Revision: 656568

URL: http://svn.apache.org/viewvc?rev=656568&view=rev
Log:
Support links without UUID and parameters (useful for links to same document, e.g. lenya-document:?lenya.module=foo)

Modified:
    lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/Link.java

Modified: lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/Link.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/Link.java?rev=656568&r1=656567&r2=656568&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/Link.java (original)
+++ lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/Link.java Thu May 15 02:27:13 2008
@@ -55,19 +55,21 @@
         
         StringTokenizer schemeAndPath = new StringTokenizer(linkUri, ":");
         schemeAndPath.nextToken();
-        String path = schemeAndPath.nextToken();
-
-        if (path.indexOf(PAIR_DELIMITER) > -1) {
-            int firstDelimiterIndex = path.indexOf(PAIR_DELIMITER);
-            this.uuid = path.substring(0, firstDelimiterIndex);
-            String pathQueryString = path.substring(firstDelimiterIndex + 1);
-            Query query = new Query(pathQueryString, PAIR_DELIMITER, KEY_VALUE_DELIMITER);
-            this.pubId = query.getValue("pub");
-            this.area = query.getValue("area");
-            this.language = query.getValue("lang");
-            this.revision = query.getValue("rev");
-        } else {
-            this.uuid = path;
+        if (schemeAndPath.hasMoreTokens()) {
+            String path = schemeAndPath.nextToken();
+    
+            if (path.indexOf(PAIR_DELIMITER) > -1) {
+                int firstDelimiterIndex = path.indexOf(PAIR_DELIMITER);
+                this.uuid = path.substring(0, firstDelimiterIndex);
+                String pathQueryString = path.substring(firstDelimiterIndex + 1);
+                Query query = new Query(pathQueryString, PAIR_DELIMITER, KEY_VALUE_DELIMITER);
+                this.pubId = query.getValue("pub");
+                this.area = query.getValue("area");
+                this.language = query.getValue("lang");
+                this.revision = query.getValue("rev");
+            } else {
+                this.uuid = path;
+            }
         }
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.