Author: thorsten
Date: Tue Oct 13 10:37:24 2009
New Revision: 824680

URL: http://svn.apache.org/viewvc?rev=824680&view=rev
Log:
Enhancing error reporting.
When the result of the contract is returning an empty document the dispatcher 
reported a "com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog". Now 
we catch this exception and reporting when this normally happens (no 
forrest:container / forrest:part). 

Modified:
    
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java

Modified: 
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
URL: 
http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java?rev=824680&r1=824679&r2=824680&view=diff
==============================================================================
--- 
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
 (original)
+++ 
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
 Tue Oct 13 10:37:24 2009
@@ -47,6 +47,7 @@
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
@@ -556,7 +557,18 @@
     // close data stream
     StreamHelper.closeStream(dataStream);
     // add the result of the contract to the overall result set
-    processContractResult(resultStream, pathNode);
+    try {
+      processContractResult(resultStream, pathNode);
+    } catch (OMException e) {
+      String error = DispatcherException.ERROR_500 + "\n"
+      + "component: ContractBean" + "\n"
+      + "message: Could not setup contractBean \"" + contract.getName() + "\". 
It seems that the result of the contract " +
+               "is returning an empty document. This normally happens when no 
forrest:content container is returned or" +
+               " the container does not contains any forrest:part.\n\n"
+      + "dispatcherErrorStack:\n" + e;
+  getLogger().error(error);
+  throw new ContractException(error);
+    }
     // close the result Stream
     StreamHelper.closeStream(resultStream);
   }