Author: sylvain
Date: Mon May 2 07:28:56 2005
New Revision: 165641
URL: http://svn.apache.org/viewcvs?rev=165641&view=rev
Log:
Fix a weird correlation between pass-through mounts and cocoon: that led to
throwing a NPE rather than a RNFE
Added:
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/another-sitemap.xmap
(with props)
Modified:
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/MutableEnvironmentFacade.java
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/explain-test.xml
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sitemap.xmap
Modified:
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java?rev=165641&r1=165640&r2=165641&view=diff
==============================================================================
---
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
(original)
+++
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
Mon May 2 07:28:56 2005
@@ -42,7 +42,7 @@
implements Composable, Disposable {
/** The key to get the pass_through value from the Environment */
- protected final static String COCOON_PASS_THROUGH = "COCOON_PASS_THROUGH";
+ public final static String COCOON_PASS_THROUGH = "COCOON_PASS_THROUGH";
/** The 'uri-prefix' attribute */
private final VariableResolver prefix;
Modified:
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/MutableEnvironmentFacade.java
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/MutableEnvironmentFacade.java?rev=165641&r1=165640&r2=165641&view=diff
==============================================================================
---
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/MutableEnvironmentFacade.java
(original)
+++
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/MutableEnvironmentFacade.java
Mon May 2 07:28:56 2005
@@ -22,6 +22,7 @@
import java.util.Map;
import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.components.treeprocessor.sitemap.MountNode;
import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.environment.Source;
import org.xml.sax.SAXException;
@@ -46,6 +47,10 @@
public MutableEnvironmentFacade(EnvironmentWrapper env) {
this.env = env;
+ // Ensure we start with a false passthrough flag.
+ // FIXME: this should really be part of the Processor contract rather
+ // than an environment attribute
+ env.setAttribute(MountNode.COCOON_PASS_THROUGH, Boolean.FALSE);
}
public EnvironmentWrapper getDelegate() {
Added:
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/another-sitemap.xmap
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/another-sitemap.xmap?rev=165641&view=auto
==============================================================================
---
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/another-sitemap.xmap
(added)
+++
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/another-sitemap.xmap
Mon May 2 07:28:56 2005
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+ <map:pipelines>
+ <map:pipeline>
+ <map:match pattern="another-welcome">
+ <map:generate src="cocoon:/non-existing-url"/>
+ <map:serialize/>
+ </map:match>
+ <map:handle-errors>
+ <map:select type="exception">
+ <map:when test="not-found">
+ <map:generate src="welcome.xml"/>
+ <map:serialize type="html"/>
+ </map:when>
+ </map:select>
+ </map:handle-errors>
+ </map:pipeline>
+ </map:pipelines>
+</map:sitemap>
\ No newline at end of file
Propchange:
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/another-sitemap.xmap
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/another-sitemap.xmap
------------------------------------------------------------------------------
svn:keywords = Id
Modified:
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/explain-test.xml
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/explain-test.xml?rev=165641&r1=165640&r2=165641&view=diff
==============================================================================
---
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/explain-test.xml
(original)
+++
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/explain-test.xml
Mon May 2 07:28:56 2005
@@ -36,5 +36,11 @@
<li><link href="aggregate">Aggregation of the
above</link></li>
</ul>
</para>
+ <para>
+ A "cocoon:" called within a pass-trough mount leading to no match
reported an NPE
+ rather than a ResourceNotFound. With the bugfix, the RNFE is
catched, and the "welcome"
+ page is displayed.
+ </para>
+ <para><link href="another-welcome">Test link</link></para>
</content>
</page>
Modified:
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sitemap.xmap
URL:
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sitemap.xmap?rev=165641&r1=165640&r2=165641&view=diff
==============================================================================
---
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sitemap.xmap
(original)
+++
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sitemap.xmap
Mon May 2 07:28:56 2005
@@ -22,9 +22,9 @@
<map:mount check-reload="true" uri-prefix=""
src="elsewhere/sitemap.xmap" pass-through="true"/>
- <map:match pattern="sub/**">
- <map:mount src="sub/" uri-prefix="sub"/>
- </map:match>
+ <map:match pattern="sub/**">
+ <map:mount src="sub/" uri-prefix="sub"/>
+ </map:match>
<map:match pattern="welcome">
<map:generate src="welcome.xml"/>
@@ -65,6 +65,11 @@
</map:aggregate>
<map:serialize/>
</map:match>
+
+ <!-- a test that produces an NPE in SitemapSource when there's a
pass-through mount in the same directory -->
+
+ <map:mount check-reload="true" uri-prefix=""
+ src="another-sitemap.xmap" pass-through="true"/>
</map:pipeline>
</map:pipelines>