dims        01/04/19 12:05:24

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
                        Notification.java
               src/org/apache/cocoon/servlet Tag: xml-cocoon2
                        CocoonServlet.java
  Log:
  Better error message notification with stack traces - useful specifically for
  diagnosing initial startup problems involving SAX Parser.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.74  +3 -3      xml-cocoon/src/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.4.2.73
  retrieving revision 1.4.2.74
  diff -u -r1.4.2.73 -r1.4.2.74
  --- Cocoon.java       2001/04/17 15:00:06     1.4.2.73
  +++ Cocoon.java       2001/04/19 19:05:23     1.4.2.74
  @@ -52,7 +52,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a> 
(Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.4.2.73 $ $Date: 2001/04/17 15:00:06 $
  + * @version CVS $Revision: 1.4.2.74 $ $Date: 2001/04/19 19:05:23 $
    */
   public class Cocoon extends AbstractLoggable implements Component, 
Initializable, Disposable, Modifiable, Processor, Contextualizable {
       /** The application context */
  @@ -154,7 +154,7 @@
               roleConfig = b.getConfiguration();
           } catch (Exception e) {
               getLogger().error("Could not configure Cocoon environment", e);
  -            throw new ConfigurationException("Error trying to load 
configurations");
  +            throw new ConfigurationException("Error trying to load 
configurations", e);
           } finally {
               if (p != null) this.componentManager.release((Component) p);
           }
  @@ -175,7 +175,7 @@
               this.configuration = b.getConfiguration();
           } catch (Exception e) {
               getLogger().error("Could not configure Cocoon environment", e);
  -            throw new ConfigurationException("Error trying to load 
configurations");
  +            throw new ConfigurationException("Error trying to load 
configurations",e);
           } finally {
               if (p != null) this.componentManager.release((Component) p);
           }
  
  
  
  1.1.2.3   +24 -7     xml-cocoon/src/org/apache/cocoon/Attic/Notification.java
  
  Index: Notification.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Notification.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- Notification.java 2000/09/22 20:19:03     1.1.2.2
  +++ Notification.java 2001/04/19 19:05:23     1.1.2.3
  @@ -15,6 +15,9 @@
   
   import org.xml.sax.SAXException;
   
  +import org.apache.avalon.CascadingException;
  +
  +
   /**
    *  Generates an XML representation of the current notification.
    *
  @@ -88,13 +91,27 @@
           this(sender);
           setType("error");
           setTitle("Cocoon error");
  -        setSource(t.getClass().getName());
  -        setMessage(t.getMessage());
  -        setDescription(t.toString());
  -
  -        StringWriter stackTrace = new StringWriter();
  -        t.printStackTrace(new PrintWriter(stackTrace));
  -        extraDescriptions.put("stacktrace", stackTrace.toString());
  +        if(t != null)
  +        {
  +            setSource(t.getClass().getName());
  +            setMessage(t.getMessage());
  +            setDescription(t.toString());
  +
  +            extraDescriptions.put("exception", t.toString());
  +            StringWriter stackTrace = new StringWriter();
  +            t.printStackTrace(new PrintWriter(stackTrace));
  +            extraDescriptions.put("stacktrace", stackTrace.toString());
  +
  +            if(t instanceof CascadingException) {
  +                Throwable cause = ((CascadingException)t).getCause();
  +                if(cause != null) {
  +                    extraDescriptions.put("embedded exception", 
cause.toString());
  +                    stackTrace = new StringWriter();
  +                    cause.printStackTrace(new PrintWriter(stackTrace));
  +                    extraDescriptions.put("embedded exception stacktrace", 
stackTrace.toString());
  +                }
  +            }
  +        }
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.82  +2 -2      
xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java,v
  retrieving revision 1.1.4.81
  retrieving revision 1.1.4.82
  diff -u -r1.1.4.81 -r1.1.4.82
  --- CocoonServlet.java        2001/04/11 12:41:26     1.1.4.81
  +++ CocoonServlet.java        2001/04/19 19:05:23     1.1.4.82
  @@ -63,7 +63,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.4.81 $ $Date: 2001/04/11 12:41:26 $
  + * @version CVS $Revision: 1.1.4.82 $ $Date: 2001/04/19 19:05:23 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -383,7 +383,7 @@
           if (this.cocoon == null) {
               res.setStatus(res.SC_INTERNAL_SERVER_ERROR);
   
  -            Notification n = new Notification(this);
  +            Notification n = new Notification(this, this.exception);
               n.setType("internal-servlet-error");
               n.setTitle("Internal servlet error");
               n.setSource("Cocoon servlet");
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to