Author: thorsten
Date: Tue Feb 19 04:15:14 2008
New Revision: 629088

URL: http://svn.apache.org/viewvc?rev=629088&view=rev
Log:
Fixing NPE with the resolver in the valid method

Modified:
    
forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java

Modified: 
forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
URL: 
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java?rev=629088&r1=629087&r2=629088&view=diff
==============================================================================
--- 
forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
 (original)
+++ 
forrest/trunk/whiteboard/cocoon-2.2-blocks/dispatcher/src/main/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
 Tue Feb 19 04:15:14 2008
@@ -45,7 +45,6 @@
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceException;
 import org.apache.excalibur.source.SourceValidity;
-import org.apache.excalibur.source.impl.validity.AggregatedValidity;
 import org.apache.excalibur.xml.xpath.XPathProcessor;
 import org.apache.forrest.dispatcher.ContractBean;
 import org.apache.forrest.dispatcher.ContractBeanDOMImpl;
@@ -245,7 +244,7 @@
     // to force a SourceValidity.INVALID
     if (null != validityFile & !(validityOverride.equals(CACHING_OFF))) {
       try {
-        this.validity.add(m_resolver.resolveURI(validityFile).getValidity());
+        this.validity = m_resolver.resolveURI(validityFile).getValidity();
       } catch (Exception e) {
         getLogger().error(e.getMessage());
       }
@@ -326,6 +325,13 @@
 
     this.hooksXSL = parameters.getParameter(HOOKS_TRANSFORMER_PARAMETER, null);
     parameterHelper.put(HOOKS_TRANSFORMER_PARAMETER, hooksXSL);
+    
+    if (null == m_resolver)
+      try {
+        m_resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
+      } catch (ServiceException e) {
+        throw new ProcessingException(e);
+      }
   }
 
   /**
@@ -514,9 +520,7 @@
         if (null == this.processor)
           this.processor = (XPathProcessor) this.manager
               .lookup(XPathProcessor.ROLE);
-        if (null == m_resolver)
-          m_resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
-      } catch (Exception e) {
+        } catch (Exception e) {
         String error = "dispatcherError:\n Could not set up the 
dispatcherHelper!\n DispatcherStack: "
             + e;
         getLogger().error(error);