cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dani...@apache.org
Subject svn commit: r495906 - in /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon: servlet/RequestProcessor.java sitemap/SitemapServlet.java
Date Sat, 13 Jan 2007 14:59:57 GMT
Author: danielf
Date: Sat Jan 13 06:59:57 2007
New Revision: 495906

URL: http://svn.apache.org/viewvc?view=rev&rev=495906
Log:
Applied patch https://issues.apache.org/jira/browse/COCOON-1954 from Alexander Klimetschek
that makes that exceptions are not swallowed while thrown from within blocks.

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestProcessor.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestProcessor.java?view=diff&rev=495906&r1=495905&r2=495906
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestProcessor.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestProcessor.java
Sat Jan 13 06:59:57 2007
@@ -111,6 +111,10 @@
     public void setProcessor(Processor processor) {
         this.processor = processor;
     }
+    
+    protected boolean rethrowExceptions() {
+        return false;
+    }
 
     /**
      * Process the specified <code>HttpServletRequest</code> producing output
@@ -143,7 +147,11 @@
             if (getLogger().isErrorEnabled()) {
                 getLogger().error("Problem with Cocoon servlet", e);
             }
-
+            
+            if (rethrowExceptions()) {
+                throw new ServletException(e);
+            }
+            
             RequestUtil.manageException(request, res, null, uri,
                             HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                             "Problem in creating the Environment", null, null, e,
@@ -158,6 +166,11 @@
                 // We reach this when there is nothing in the processing change that matches
                 // the request. For example, no matcher matches.
                 getLogger().fatalError("The Cocoon engine failed to process the request.");
+
+                if (rethrowExceptions()) {
+                    throw new ServletException("The Cocoon engine failed to process the request.");
+                }
+
                 RequestUtil.manageException(request, res, env, uri,
                                 HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                                 "Request Processing Failed",
@@ -174,6 +187,10 @@
                 getLogger().warn(e.getMessage());
             }
 
+            if (rethrowExceptions()) {
+                throw new ServletException(e);
+            }
+                 
             RequestUtil.manageException(request, res, env, uri,
                             HttpServletResponse.SC_NOT_FOUND,
                             "Resource Not Found",
@@ -201,6 +218,10 @@
         } catch (Exception e) {
             if (getLogger().isErrorEnabled()) {
                 getLogger().error("Internal Cocoon Problem", e);
+            }
+
+            if (rethrowExceptions()) {
+                throw new ServletException(e);
             }
 
             RequestUtil.manageException(request, res, env, uri,

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java?view=diff&rev=495906&r1=495905&r2=495906
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java
Sat Jan 13 06:59:57 2007
@@ -71,6 +71,10 @@
             super(servletContext);
         }
 
+        protected boolean rethrowExceptions() {
+            return true;
+        }
+
         protected Processor getProcessor() {
             ServiceManager serviceManager =
                 (ServiceManager) this.cocoonBeanFactory.getBean(AvalonUtils.SERVICE_MANAGER_ROLE);



Mime
View raw message