cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r406710 - /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java
Date Mon, 15 May 2006 18:48:41 GMT
Author: cziegeler
Date: Mon May 15 11:48:40 2006
New Revision: 406710

URL: http://svn.apache.org/viewcvs?rev=406710&view=rev
Log:
Quickfix for NPE

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java?rev=406710&r1=406709&r2=406710&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java
Mon May 15 11:48:40 2006
@@ -34,6 +34,7 @@
 import org.apache.cocoon.environment.SourceResolver;
 import org.apache.cocoon.xml.XMLConsumer;
 import org.apache.excalibur.source.Source;
+import org.springframework.beans.factory.BeanFactory;
 
 /**
  * Helper class for maintaining the environment stack.
@@ -391,7 +392,17 @@
         final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
         if ( stack != null && !stack.isEmpty()) {
             EnvironmentInfo info = stack.getCurrentInfo();
-            return (ServiceManager) info.processor.getBeanFactory().getBean(ProcessingUtil.SERVICE_MANAGER_ROLE);
+            Processor processor = info.processor;
+            BeanFactory factory = info.processor.getBeanFactory();
+            while ( factory == null && processor != null ) {
+                processor = processor.getParent();
+                if ( processor != null ) {
+                    factory = processor.getBeanFactory();
+                }
+            }
+            if ( factory != null ) {
+                return (ServiceManager) factory.getBean(ProcessingUtil.SERVICE_MANAGER_ROLE);
+            }
         }
         return null;
     }



Mime
View raw message