cziegeler 2003/07/28 23:28:55
Modified: src/java/org/apache/cocoon/components/treeprocessor/sitemap
SwitchSelectNode.java
Log:
Fixing NPE. Thanks to Volker!
Revision Changes Path
1.2 +9 -3
cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SwitchSelectNode.java
Index: SwitchSelectNode.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SwitchSelectNode.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SwitchSelectNode.java 9 Mar 2003 00:09:22 -0000 1.1
+++ SwitchSelectNode.java 29 Jul 2003 06:28:54 -0000 1.2
@@ -128,6 +128,9 @@
if (this.threadSafeSelector != null) {
Object ctx =
this.threadSafeSelector.getSelectorContext(objectModel, resolvedParams);
+ if ( ctx == null ) {
+ return false;
+ }
for (int i = 0; i < this.whenTests.length; i++) {
if
(this.threadSafeSelector.select(whenTests[i].resolve(context, objectModel),
ctx)) {
@@ -145,9 +148,12 @@
SwitchSelector selector =
(SwitchSelector)this.selector.select(this.componentName);
Object ctx = selector.getSelectorContext(objectModel,
resolvedParams);
-
+
try {
-
+ if ( ctx == null ) {
+ return false;
+ }
+
for (int i = 0; i < this.whenTests.length; i++) {
if (selector.select(whenTests[i].resolve(context,
objectModel), ctx)) {
return invokeNodes(this.whenNodes[i], env, context);