cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/servlet CocoonServlet.java
Date Mon, 15 Jul 2002 13:52:57 GMT
cziegeler    2002/07/15 06:52:57

  Modified:    src/java/org/apache/cocoon/servlet Tag: cocoon_2_0_3_branch
                        CocoonServlet.java
  Log:
  Corrected error handling
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.19.2.8  +31 -38    xml-cocoon2/src/java/org/apache/cocoon/servlet/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/servlet/CocoonServlet.java,v
  retrieving revision 1.19.2.7
  retrieving revision 1.19.2.8
  diff -u -r1.19.2.7 -r1.19.2.8
  --- CocoonServlet.java	13 Jul 2002 13:13:21 -0000	1.19.2.7
  +++ CocoonServlet.java	15 Jul 2002 13:52:57 -0000	1.19.2.8
  @@ -918,29 +918,27 @@
   
           // Check if cocoon was initialized
           if (this.cocoon == null) {
  -          if(manageExceptions){
  -            res.reset();
  +            if(manageExceptions){
  +                res.reset();
   
  -            SimpleNotifyingBean n = new SimpleNotifyingBean(this);
  -            n.setType("fatal");
  -            n.setTitle("Internal servlet error");
  -            n.setSource("Cocoon servlet");
  -            n.setMessage("Cocoon was not initialized.");
  -            n.setDescription("Cocoon was not initialized. Cannot process request.");
  -            n.addExtraDescription("request-uri", request.getRequestURI());
  -
  -            res.setContentType("text/html");
  -            res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  -            Notifier.notify(n, res.getOutputStream(), "text/html");
  -         }
  -         else{
  -           res.sendError
  -            (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
  -             "The Cocoon engine said it failed to process the request for an unknown reason."
);
  -            res.flushBuffer();
  +                SimpleNotifyingBean n = new SimpleNotifyingBean(this);
  +                n.setType("fatal");
  +                n.setTitle("Internal servlet error");
  +                n.setSource("Cocoon servlet");
  +                n.setMessage("Cocoon was not initialized.");
  +                n.setDescription("Cocoon was not initialized. Cannot process request.");
  +                n.addExtraDescription("request-uri", request.getRequestURI());
  +
  +                res.setContentType("text/html");
  +                res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  +                Notifier.notify(n, res.getOutputStream(), "text/html");
  +            } else {
  +                res.sendError
  +                 (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
  +                 "The Cocoon engine said it failed to process the request for an unknown
reason." );
  +                res.flushBuffer();
  +            }
               return;
  -         }
  -
           }
   
           // We got it... Process the request
  @@ -1017,14 +1015,13 @@
                         res.setContentType("text/html");
                         res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                         Notifier.notify(n, res.getOutputStream(), "text/html");
  -                    }
  -                    else{
  +                    } else {
                         res.sendError
                          (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                           "The Cocoon engine said it failed to process the request for an
unknown reason." );
                         res.flushBuffer();
  -                      return;
                       }
  +                    return;
   
                   }
               } catch (ResourceNotFoundException rse) {
  @@ -1049,19 +1046,17 @@
                     res.setContentType("text/html");
                     res.setStatus(HttpServletResponse.SC_NOT_FOUND);
                     Notifier.notify(n, res.getOutputStream(), "text/html");
  -                  }
  -                  else{
  +                } else {
                       res.sendError
                        (HttpServletResponse.SC_NOT_FOUND, "Resource not found." );
                       res.flushBuffer();
  -                    return;
  -                  }
  -
  +                }
  +                return;
  + 
               } catch (ConnectionResetException cre) {
                   if (log.isDebugEnabled()) {
                       log.debug("The connection was reset", cre);
  -                }
  -                else if (log.isWarnEnabled()) {
  +                } else if (log.isWarnEnabled()) {
                       log.warn("The connection was reset.");
                   }
   
  @@ -1086,14 +1081,13 @@
                     res.setContentType("text/html");
                     res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                     Notifier.notify(n, res.getOutputStream(), "text/html");
  -                  }
  -                  else{
  +                } else {
                       res.sendError
                        (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                         "Internal server error.");
                       res.flushBuffer();
  -                    return;
  -                  }
  +                }
  +                return;
               }
   
               long end = System.currentTimeMillis();
  @@ -1125,8 +1119,7 @@
                    ServletOutputStream out = res.getOutputStream();
                    out.flush();
                    out.close();
  -            }
  -            catch(Exception e){
  +            } catch(Exception e) {
                 log.error("Cocoon servlet threw an Exception while trying to close stream.",
e);
               }
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message