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

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Mon Feb 11 15:43:16 2008
New Revision: 620670

URL: http://svn.apache.org/viewvc?rev=620670&view=rev
Log:
Avoid building URLInformation objects for URLs which don't start with a slash in UrlToUuidRewriter.

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

Modified: lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/UrlToUuidRewriter.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/UrlToUuidRewriter.java?rev=620670&r1=620669&r2=620670&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/UrlToUuidRewriter.java (original)
+++ lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/UrlToUuidRewriter.java Mon Feb 11 15:43:16 2008
@@ -46,18 +46,20 @@
     }
 
     public boolean matches(String url) {
-        URLInformation info = new URLInformation(url);
-        String pubId = info.getPublicationId();
-        String area = info.getArea();
-        if (pubId != null && area != null) {
-            if (this.factory.existsPublication(pubId)) {
-                try {
-                    Publication pub = this.factory.getPublication(pubId);
-                    if (Arrays.asList(pub.getAreaNames()).contains(area)) {
-                        return true;
+        if (url.startsWith("/")) {
+            URLInformation info = new URLInformation(url);
+            String pubId = info.getPublicationId();
+            String area = info.getArea();
+            if (pubId != null && area != null) {
+                if (this.factory.existsPublication(pubId)) {
+                    try {
+                        Publication pub = this.factory.getPublication(pubId);
+                        if (Arrays.asList(pub.getAreaNames()).contains(area)) {
+                            return true;
+                        }
+                    } catch (Exception e) {
+                        throw new RuntimeException(e);
                     }
-                } catch (Exception e) {
-                    throw new RuntimeException(e);
                 }
             }
         }
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.