svn commit: r617160 - /lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/PageEnvelope.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Thu Jan 31 09:09:24 2008
New Revision: 617160

URL: http://svn.apache.org/viewvc?rev=617160&view=rev
Log:
Don't try to build document with invalid area in PageEnvelope.init()

Modified:
    lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/PageEnvelope.java

Modified: lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/PageEnvelope.java
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/PageEnvelope.java?rev=617160&r1=617159&r2=617160&view=diff
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/PageEnvelope.java (original)
+++ lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/PageEnvelope.java Thu Jan 31 09:09:24 2008
@@ -84,6 +84,7 @@
     public static final String DEFAULT_PREFIX = "lenya";
 
     private String context;
+    private Publication pub;
 
     /**
      * Constructor.
@@ -182,6 +183,9 @@
     throws PageEnvelopeException {
         assert publication != null;
         assert request != null;
+        
+        this.pub = publication;
+        
         String webappURI;
         try {
 
@@ -191,10 +195,13 @@
             }
 
             webappURI = ServletHelper.getWebappURI(request);
-            Document document =
-                publication.getDocumentBuilder().buildDocument(publication, webappURI);
-            setDocument(document);
-
+            URLInformation info = new URLInformation(webappURI);
+            String area = info.getArea();
+            if (area != null && AbstractPublication.isValidArea(area) && info.getDocumentUrl() != null) {
+                Document document =
+                    publication.getDocumentBuilder().buildDocument(publication, webappURI);
+                setDocument(document);
+            }
         } catch (Exception e) {
             throw new PageEnvelopeException(e);
         }
@@ -233,7 +240,7 @@
      * @return a <code>Publication</code> value
      */
     public Publication getPublication() {
-        return getDocument().getPublication();
+        return this.pub;
     }
 
     /**
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.