Same patch as in the previous mail but for the 20 branch.
I recommend it if you're having problems in developing because
of difficult error messages.
Nicola Ken Barozzi These are the days of miracle and wonder...
...so don't cry baby, don't cry
<[EMAIL PROTECTED]> Paul Simon
*** src/org/apache/cocoon/notification/DefaultNotificationBuilder.java Wed Dec 31
14:00:00 1969
--- src/org/apache/cocoon/notification/DefaultNotificationBuilder.java Sun Dec 9
10:43:48 2001
***************
*** 0 ****
--- 1,152 ----
+ /*****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
+ **************************************************************************** *
+ */
+
+ package org.apache.cocoon.notification;
+
+ import org.apache.avalon.framework.CascadingThrowable;
+ import org.xml.sax.SAXException;
+ import java.io.PrintWriter;
+ import java.io.StringWriter;
+ import java.util.HashMap;
+
+
+ /**
+ * Generates an Notification representation of widely used objects.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a>
+ * @created 24 August 2000
+ */
+ public class DefaultNotificationBuilder
+ implements NotificableBuilder {
+
+ /**
+ * @param sender
+ * @param o
+ * @return
+ */
+ public Notificable build (Object sender, Object o) {
+ if (o instanceof Notificable) {
+ return (Notificable)o;
+ }
+ else if (o instanceof Throwable) {
+ Throwable t = (Throwable)o;
+ Notification n = new Notification(sender);
+ n.setType("error");
+ n.setTitle("Something went wrong.");
+ if (t != null) {
+ n.setSource(t.getClass().getName());
+ n.setMessage(t.getMessage());
+ n.setDescription(t.toString());
+
+ Throwable rootT = getRootCause(t);
+ n.addExtraDescription("original message", rootT.toString());
+
+ // get the stacktrace: if the exception is a SAXException,
+ // the stacktrace of the embedded exception is used as the
+ // SAXException does not append it automatically
+ Throwable stackTraceException;
+ if (t instanceof SAXException && ((SAXException)t).getException() !=
+ null) {
+ stackTraceException = ((SAXException)t).getException();
+ }
+ else {
+ stackTraceException = t;
+ }
+ StringWriter sw = new StringWriter();
+ stackTraceException.printStackTrace(new PrintWriter(sw));
+ n.addExtraDescription("stacktrace", sw.toString());
+ // Add nested throwables description
+ sw = new StringWriter();
+ appendCauses(new PrintWriter(sw), stackTraceException);
+ String causes = sw.toString();
+ if (causes != null && causes.length() != 0) {
+ n.addExtraDescription("full exception chain stacktrace", causes);
+ }
+ }
+ return n;
+ }
+ else {
+ Notification n = new Notification(sender);
+ n.setType("unknown");
+ n.setTitle("Object notification");
+ n.setSource(o.getClass().getName());
+ n.setMessage(o.toString());
+ n.setDescription("No details available.");
+ return n;
+ }
+ }
+
+ public Notificable build(Object sender, Object o, String type, String title,
+String source, String message, String description, HashMap extra)
+ {
+ //NKB Cast here is secure, the method is of this class
+ Notification n = (Notification)build (sender, o);
+
+ if(type!=null)
+ n.setType(type);
+ if(title!=null)
+ n.setTitle(title);
+ if(source!=null)
+ n.setSource(source);
+ if(message!=null)
+ n.setMessage(message);
+ if(description!=null)
+ n.setDescription(description);
+ if(extra!=null)
+ n.replaceExtraDescriptions(extra);
+
+ return n;
+ }
+
+
+ /**
+ * Print recursively all nested causes of a Throwable in a PrintWriter.
+ */
+ private static void appendCauses (PrintWriter out, Throwable t) {
+ Throwable cause = null;
+ if (t instanceof CascadingThrowable) {
+ cause = ((CascadingThrowable)t).getCause();
+ }
+ else if (t instanceof SAXException) {
+ cause = ((SAXException)t).getException();
+ }
+ else if (t instanceof java.sql.SQLException) {
+ cause = ((java.sql.SQLException)t).getNextException();
+ }
+ if (cause != null) {
+ out.print("Original exception : ");
+ cause.printStackTrace(out);
+ out.println();
+ // Recurse
+ appendCauses(out, cause);
+ }
+ }
+
+ /**
+ * Get root Exception.
+ */
+ private static Throwable getRootCause (Throwable t) {
+ Throwable cause = null;
+ if (t instanceof CascadingThrowable) {
+ cause = ((CascadingThrowable)t).getCause();
+ }
+ else if (t instanceof SAXException) {
+ cause = ((SAXException)t).getException();
+ }
+ else if (t instanceof java.sql.SQLException) {
+ cause = ((java.sql.SQLException)t).getNextException();
+ }
+ if (cause == null){
+ return t;
+ }
+ else{
+ // Recurse
+ return getRootCause(cause);
+ }
+ }
+ }
*** src/org/apache/cocoon/notification/Notificable.java Wed Dec 31 14:00:00 1969
--- src/org/apache/cocoon/notification/Notificable.java Sun Dec 9 10:43:48 2001
***************
*** 0 ****
--- 1,66 ----
+ /*****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
+ *****************************************************************************/
+
+ package org.apache.cocoon.notification;
+
+ import java.util.HashMap;
+
+ /**
+ * Interface for Objects that can notify something.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a>
+ * @created 24 August 2000
+ */
+
+ public interface Notificable {
+
+ /**
+ * Proposed types of notifications
+ */
+ public static final String UNKNOWN_NOTIFICATION = "unknown";
+ public static final String DEBUG_NOTIFICATION = "debug";
+ public static final String INFO_NOTIFICATION = "info" ;
+ public static final String WARN_NOTIFICATION = "warn" ;
+ public static final String ERROR_NOTIFICATION = "error";
+ public static final String FATAL_NOTIFICATION = "fatal";
+
+ /**
+ * Gets the Type attribute of the Notificable object
+ */
+ String getType();
+
+ /**
+ * Gets the Title attribute of the Notificable object
+ */
+ String getTitle();
+
+ /**
+ * Gets the Source attribute of the Notificable object
+ */
+ String getSource();
+
+ /**
+ * Gets the Sender attribute of the Notificable object
+ */
+ String getSender();
+
+ /**
+ * Gets the Message attribute of the Notificable object
+ */
+ String getMessage();
+
+ /**
+ * Gets the Description attribute of the Notificable object
+ */
+ String getDescription();
+
+ /**
+ * Gets the ExtraDescriptions attribute of the Notificable object
+ */
+ HashMap getExtraDescriptions();
+ }
*** src/org/apache/cocoon/notification/NotificableBuilder.java Wed Dec 31 14:00:00
1969
--- src/org/apache/cocoon/notification/NotificableBuilder.java Sun Dec 9 10:25:52
2001
***************
*** 0 ****
--- 1,25 ----
+ /*****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
+ *****************************************************************************/
+
+ package org.apache.cocoon.notification;
+
+ import java.util.HashMap;
+
+ /**
+ * Generates an Notificable representation of widely used objects.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a>
+ * @created 24 August 2000
+ */
+
+ public interface NotificableBuilder{
+
+ public Notificable build(Object sender, Object o);
+ public Notificable build(Object sender, Object o, String type, String title,
+String source, String message, String description, HashMap extra);
+ }
+
*** src/org/apache/cocoon/notification/NotificableBuilderFactory.java Wed Dec 31
14:00:00 1969
--- src/org/apache/cocoon/notification/NotificableBuilderFactory.java Sat Dec 8
17:28:02 2001
***************
*** 0 ****
--- 1,32 ----
+ /*****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
+ *****************************************************************************/
+
+ package org.apache.cocoon.notification;
+
+
+ /**
+ * Creates NotificableBuilder in response to a hint.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
+ * @created 24 August 2000
+ */
+
+ public class NotificableBuilderFactory{
+
+ private static NotificableBuilder notificableBuilder
+ = new DefaultNotificationBuilder();
+
+ //NKB for now defaults only - the hint is for future extensions,
+ //put now to keep contract stable
+ public static NotificableBuilder builder(Object hint)
+ {
+ return notificableBuilder;
+ }
+
+ }
+
*** src/org/apache/cocoon/notification/NotificableCascadingRuntimeException.java
Wed Dec 31 14:00:00 1969
--- src/org/apache/cocoon/notification/NotificableCascadingRuntimeException.java
Sun Dec 9 10:43:48 2001
***************
*** 0 ****
--- 1,106 ----
+ /*****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
+ *****************************************************************************/
+ package org.apache.cocoon.notification;
+
+ import org.apache.avalon.framework.CascadingRuntimeException;
+
+ import java.util.HashMap;
+
+ import java.io.PrintStream;
+ import java.io.PrintWriter;
+
+ /**
+ * A CascadingRuntimeException that is also Notificable.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a>
+ * @created 7 December 2001
+ */
+ public class NotificableCascadingRuntimeException extends CascadingRuntimeException {
+
+ /**
+ * The Notification used internally to keep Notification fields
+ */
+ Notificable n;
+
+ /**
+ * Construct a new <code>NotificableCascadingRuntimeException</code> instance.
+ */
+ public NotificableCascadingRuntimeException(String message) {
+ super(message, null);
+ n=NotificableBuilderFactory.builder(this).build(this, message);
+ }
+
+ /**
+ * Creates a new <code>ProcessingException</code> instance.
+ *
+ * @param ex an <code>Exception</code> value
+ */
+ public NotificableCascadingRuntimeException(Exception ex) {
+ super(ex.getMessage(), ex);
+ n=NotificableBuilderFactory.builder(this).build(this, ex);
+ }
+
+ /**
+ * Construct a new <code>ProcessingException</code> that references
+ * a parent Exception.
+ */
+ public NotificableCascadingRuntimeException(String message, Throwable t) {
+ super(message, t);
+ n=NotificableBuilderFactory.builder(this).build(this, t);
+ }
+
+ /**
+ * Gets the Type attribute of the Notificable object
+ */
+ public String getType(){
+ return n.getType();
+ }
+
+ /**
+ * Gets the Title attribute of the Notificable object
+ */
+ public String getTitle(){
+ return n.getTitle();
+ }
+
+ /**
+ * Gets the Source attribute of the Notificable object
+ */
+ public String getSource(){
+ return n.getSource();
+ }
+
+ /**
+ * Gets the Sender attribute of the Notificable object
+ */
+ public String getSender(){
+ return n.getSender();
+ }
+
+ /**
+ * Gets the Message attribute of the Notificable object
+ */
+ public String getMessage(){
+ return n.getMessage();
+ }
+
+ /**
+ * Gets the Description attribute of the Notificable object
+ */
+ public String getDescription(){
+ return n.getDescription();
+ }
+
+ /**
+ * Gets the ExtraDescriptions attribute of the Notificable object
+ */
+ public HashMap getExtraDescriptions(){
+ return n.getExtraDescriptions();
+ }
+
+ }
*** src/org/apache/cocoon/notification/Notification.java Wed Dec 31 14:00:00
1969
--- src/org/apache/cocoon/notification/Notification.java Sun Dec 9 10:42:48
2001
***************
*** 0 ****
--- 1,199 ----
+ /*****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
+ *****************************************************************************/
+
+ package org.apache.cocoon.notification;
+
+ import org.apache.avalon.framework.CascadingThrowable;
+ import org.xml.sax.SAXException;
+
+ import java.io.PrintWriter;
+ import java.io.StringWriter;
+ import java.util.HashMap;
+
+
+ /**
+ * Generates an XML representation of the current notification.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a>
+ * @created 24 August 2000
+ */
+
+ public class Notification implements Notificable {
+
+ /**
+ * The type of the notification. Examples can be "warning" or "error"
+ */
+ private String type = "unknown";
+
+ /**
+ * The title of the notification.
+ */
+ private String title = "";
+
+ /**
+ * The source that generates the notification.
+ */
+ private String source = "";
+
+ /**
+ * The sender of the notification.
+ */
+ private String sender = "";
+
+ /**
+ * The notification itself.
+ */
+ private String message = "Message not known.";
+
+ /**
+ * A more detailed description of the notification.
+ */
+ private String description = "No details available.";
+
+ /**
+ * A Hashtable containing extra notifications
+ */
+ private HashMap extraDescriptions = new HashMap();
+
+ public Notification(Object sender) {
+ this.sender=sender.getClass().getName();
+ setSource(this.getClass().getName());
+ setTitle("Generic notification");
+ }
+
+ /**
+ * Sets the Type attribute of the Notification object
+ *
+ *@param type The new Type value
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Sets the Title attribute of the Notification object
+ *
+ *@param title The new Title value
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * Sets the Source attribute of the Notification object
+ *
+ *@param source The new Source value
+ */
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ /**
+ * Sets the Sender attribute of the Notification object
+ *
+ *@param sender The new sender value
+ */
+ private void setSender(Object sender) {
+ this.sender = sender.getClass().getName();
+ }
+
+ /**
+ * Sets the Sender attribute of the Notification object
+ *
+ *@param sender The new sender value
+ */
+ private void setSender(String sender) {
+ this.sender = sender;
+ }
+
+ /**
+ * Sets the Message attribute of the Notification object
+ *
+ *@param message The new Message value
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ /**
+ * Sets the Description attribute of the Notification object
+ *
+ *@param description The new Description value
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the ExtraDescriptions attribute of the Notification object
+ *
+ *@param extraDescriptions The new ExtraDescriptions value
+ */
+ public void addExtraDescription(String extraDescriptionDescription,
+ String extraDescription) {
+ this.extraDescriptions.put(extraDescriptionDescription,
+ extraDescription);
+ }
+
+ /**
+ * Gets the ExtraDescriptions attribute of the Notification object
+ */
+ protected void replaceExtraDescriptions(HashMap extraDescriptions) {
+ this.extraDescriptions = extraDescriptions;
+ }
+
+ /**
+ * Gets the Type attribute of the Notification object
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Gets the Title attribute of the Notification object
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Gets the Source attribute of the Notification object
+ */
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ * Gets the Sender attribute of the Notification object
+ */
+ public String getSender() {
+ return sender;
+ }
+
+ /**
+ * Gets the Message attribute of the Notification object
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Gets the Description attribute of the Notification object
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the ExtraDescriptions attribute of the Notification object
+ */
+ public HashMap getExtraDescriptions() {
+ return extraDescriptions;
+ }
+ }
+
*** src/org/apache/cocoon/notification/Notifier.java Wed Dec 31 14:00:00 1969
--- src/org/apache/cocoon/notification/Notifier.java Sat Dec 8 17:29:22 2001
***************
*** 0 ****
--- 1,141 ----
+ /*****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
+ *****************************************************************************/
+
+ package org.apache.cocoon.notification;
+
+ import org.apache.cocoon.Constants;
+
+ import org.xml.sax.ContentHandler;
+ import org.xml.sax.SAXException;
+ import org.xml.sax.helpers.AttributesImpl;
+
+ import java.io.IOException;
+ import java.io.OutputStream;
+ import java.util.HashMap;
+ import java.util.Iterator;
+
+ /**
+ * Generates an XML representation of the current notification.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
+ * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
+ * @version CVS $Revision: 1.2.2.4 $ $Date: 2001/10/11 08:56:04 $
+ */
+
+ public class Notifier {
+
+ /**
+ * Generate notification information as a response.
+ * The notification is directly written to the OutputStream.
+ * @param n The <code>Notificable</code> object
+ * @param outputStream The output stream the notification is written to
+ * This could be <code>null</code>.
+ * @return The content type for this notification
+ * (currently always text/html)
+ */
+ public static String notify(Notificable n, OutputStream outputStream)
+ throws IOException {
+
+ StringBuffer sb = new StringBuffer();
+
+ sb.append("<html><head><title>").append(n.getTitle()).append("</title>");
+ sb.append("<STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color :
+white;background-color : #0086b2;} ");
+ sb.append("BODY{font-family : sans-serif,Arial,Tahoma;color :
+black;background-color : white;} ");
+ sb.append("B{color : white;background-color : #0086b2;} ");
+ sb.append("HR{color : #0086b2;} ");
+ sb.append("--></STYLE> ");
+ sb.append("</head><body>");
+ sb.append("<h1>Cocoon 2 - ").append(n.getTitle()).append("</h1>");
+ sb.append("<HR size=\"1\" noshade>");
+ sb.append("<p><b>type</b> ").append(n.getType()).append("</p>");
+ sb.append("<p><b>message</b> <u>").append(n.getMessage()).append("</u></p>");
+ sb.append("<p><b>description</b>
+<u>").append(n.getDescription()).append("</u></p>");
+ sb.append("<p><b>sender</b> ").append(n.getSender()).append("</p>");
+ sb.append("<p><b>source</b> ").append(n.getSource()).append("</p>");
+
+ HashMap extraDescriptions = n.getExtraDescriptions();
+ Iterator keyIter = extraDescriptions.keySet().iterator();
+
+ while (keyIter.hasNext()) {
+ String key = (String) keyIter.next();
+
+
+sb.append("<p><b>").append(key).append("</b><pre>").append(extraDescriptions.get(key)).append("</pre></p>");
+ }
+
+ sb.append("<HR size=\"1\" noshade>");
+ sb.append("</body></html>");
+
+ if (outputStream != null) outputStream.write(sb.toString().getBytes());
+ // FIXME (SM) how can we send the error with the proper content type?
+
+ return "text/html";
+ }
+
+ /**
+ * Generate notification information in XML format.
+ */
+ public static void notify(Notificable n, ContentHandler ch) throws SAXException {
+
+ final String PREFIX = Constants.ERROR_NAMESPACE_PREFIX;
+ final String URI = Constants.ERROR_NAMESPACE_URI;
+
+ // Start the document
+ ch.startDocument();
+ ch.startPrefixMapping(PREFIX, URI);
+
+ // Root element.
+ AttributesImpl atts = new AttributesImpl();
+
+ atts.addAttribute(URI, "type", PREFIX+":type", "CDATA", n.getType());
+ atts.addAttribute(URI, "sender", PREFIX+":sender", "CDATA", n.getSender());
+ ch.startElement(URI, "notify", PREFIX+":notify", atts);
+ ch.startElement(URI, "title", PREFIX+":title", new AttributesImpl());
+ ch.characters(n.getTitle().toCharArray(), 0, n.getTitle().length());
+ ch.endElement(URI, "title", PREFIX+":title");
+ ch.startElement(URI, "source", PREFIX+":source", new AttributesImpl());
+ ch.characters(n.getSource().toCharArray(), 0, n.getSource().length());
+ ch.endElement(URI, "source", PREFIX+":source");
+ ch.startElement(URI, "message", PREFIX+":message", new AttributesImpl());
+
+ if (n.getMessage() != null) {
+ ch.characters(n.getMessage().toCharArray(), 0,
+ n.getMessage().length());
+ }
+
+ ch.endElement(URI, "message", PREFIX+":message");
+ ch.startElement(URI, "description", PREFIX+":description",
+ new AttributesImpl());
+ ch.characters(n.getDescription().toCharArray(), 0,
+ n.getDescription().length());
+ ch.endElement(URI, "description", PREFIX+":description");
+
+ HashMap extraDescriptions = n.getExtraDescriptions();
+ Iterator keyIter = extraDescriptions.keySet().iterator();
+
+ while (keyIter.hasNext()) {
+ String key = (String) keyIter.next();
+
+ atts = new AttributesImpl();
+
+ atts.addAttribute(URI, "description", PREFIX+":description", "CDATA",
+ key);
+ ch.startElement(URI, "extra", PREFIX+":extra", atts);
+ ch.characters(extraDescriptions.get(key).toString().toCharArray(),
+ 0, (extraDescriptions.get(key).toString())
+ .length());
+ ch.endElement(URI, "extra", PREFIX+":extra");
+ }
+
+ // End root element.
+ ch.endElement(URI, "notify", PREFIX+":notify");
+
+ // End the document.
+ ch.endPrefixMapping(PREFIX);
+ ch.endDocument();
+ }
+ }
*** webapp/stylesheets/system/simple-error2html.xsl Wed Dec 31 14:00:00 1969
--- webapp/stylesheets/system/simple-error2html.xsl Sun Dec 9 11:30:48 2001
***************
*** 0 ****
--- 1,114 ----
+ <?xml version="1.0"?>
+
+ <xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:error="http://apache.org/cocoon/error/2.0">
+
+ <xsl:template match="error:notify">
+ <html>
+ <head>
+ <title>
+ <xsl:value-of select="@type"/>:<xsl:value-of select="error:title"/>
+ </title>
+ </head>
+ <body bgcolor="#ffffff">
+ <table border="0" bgcolor="#000000" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td bgcolor="#0086b2" colspan="2">
+ <font color="#ffffff" face="arial,helvetica,sanserif" size="+2">
+ <xsl:value-of select="error:title"/>
+ </font>
+ </td>
+ </tr>
+
+ <tr>
+ <td bgcolor="#0086b2" valign="top">
+ <font color="#ffffff" face="arial,helvetica,sanserif" size="+1">
+ <xsl:value-of select="@type"/>
+ </font>
+ </td>
+ <td bgcolor="#ffffff" >
+ <xsl:apply-templates select="error:message"/>
+ </td>
+ </tr>
+
+ <tr>
+ <td bgcolor="#0086b2" valign="top" colspan="2">
+ <font color="#ffffff" face="arial,helvetica,sanserif" size="+1">details</font>
+ </td>
+ </tr>
+
+ <tr>
+ <td bgcolor="#0086b2" valign="top">
+ <font face="arial,helvetica,sanserif" color="#ffffff">from</font>
+ </td>
+ <td bgcolor="#ffffff">
+ <font face="arial,helvetica,sanserif">
+ <xsl:value-of select="@sender"/>
+ </font>
+ </td>
+ </tr>
+
+ <tr>
+ <td bgcolor="#0086b2" valign="top">
+ <font face="arial,helvetica,sanserif" color="#ffffff">source</font>
+ </td>
+ <td bgcolor="#ffffff">
+ <font face="arial,helvetica,sanserif">
+ <xsl:value-of select="error:source"/>
+ </font>
+ </td>
+ </tr>
+
+ <xsl:apply-templates select="error:description"/>
+
+ <tr>
+ <td bgcolor="#0086b2" valign="top" colspan="2">
+ <font color="#ffffff" face="arial,helvetica,sanserif" size="+1">extra
+info</font>
+ </td>
+ </tr>
+
+ <xsl:apply-templates select="error:extra"/>
+
+ </tbody>
+ </table>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="error:description">
+ <tr>
+ <td bgcolor="#0086b2" valign="top">
+ <font color="#ffffff" face="arial,helvetica,sanserif">description</font>
+ </td>
+ <td bgcolor="#ffffff">
+ <font face="arial,helvetica,sanserif">
+ <xsl:value-of select="."/>
+ </font>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="error:message">
+ <font face="arial,helvetica,sanserif">
+ <xsl:value-of select="."/>
+ </font>
+ </xsl:template>
+
+ <xsl:template match="error:extra">
+ <tr>
+ <td bgcolor="#0086b2" valign="top">
+ <font color="#ffffff" face="arial,helvetica,sanserif">
+ <xsl:value-of select="@description"/>
+ </font>
+ </td>
+ <td bgcolor="#ffffff">
+ <xsl:variable name="x" select="translate(.,' ',' ')"/>
+ <pre>
+ <xsl:value-of select="$x"/>
+ </pre>
+ </td>
+ </tr>
+ </xsl:template>
+ </xsl:stylesheet>
*** src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
2001/12/07 10:18:25 1.11.2.41
--- src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
2001/12/09 11:47:43
***************
*** 743,749 ****
eventPipeline.setGenerator ("!error-notifier!", e.getMessage(),
emptyParam, e);
<xsl:apply-templates select="./*"/>
} catch (Exception ex) {
! if (getLogger().isErrorEnabled()) getLogger().error("error notifier
barfs", ex);
throw e;
} finally {
if(eventPipeline != null)
--- 743,749 ----
eventPipeline.setGenerator ("!error-notifier!", e.getMessage(),
emptyParam, e);
<xsl:apply-templates select="./*"/>
} catch (Exception ex) {
! if (getLogger().isErrorEnabled()) getLogger().error("error notifier
was not able to notify the exception", ex);
throw e;
} finally {
if(eventPipeline != null)
*** src/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java
2001/11/28 11:18:21 1.5.2.12
--- src/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java
2001/12/09 11:47:46
***************
*** 68,74 ****
// (The sitemap uses this setGenerator() method only from inside
// the error pipeline, when a ErrorNotifier is explicitly generated.)
if (this.generator instanceof ErrorNotifier) {
! ((ErrorNotifier)this.generator).setException(e);
}
}
--- 68,74 ----
// (The sitemap uses this setGenerator() method only from inside
// the error pipeline, when a ErrorNotifier is explicitly generated.)
if (this.generator instanceof ErrorNotifier) {
! ((ErrorNotifier)this.generator).setThrowable(e);
}
}
*** src/org/apache/cocoon/servlet/CocoonServlet.java 2001/11/23 14:40:22
1.13.2.35
--- src/org/apache/cocoon/servlet/CocoonServlet.java 2001/12/09 11:47:51
***************
*** 16,23 ****
import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.logger.Loggable;
import org.apache.cocoon.Constants;
! import org.apache.cocoon.Notification;
! import org.apache.cocoon.Notifier;
import org.apache.cocoon.ResourceNotFoundException;
import org.apache.cocoon.ConnectionResetException;
import org.apache.cocoon.Cocoon;
--- 16,25 ----
import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.logger.Loggable;
import org.apache.cocoon.Constants;
! import org.apache.cocoon.notification.Notificable;
! import org.apache.cocoon.notification.Notification;
! import org.apache.cocoon.notification.NotificableBuilderFactory;
! import org.apache.cocoon.notification.Notifier;
import org.apache.cocoon.ResourceNotFoundException;
import org.apache.cocoon.ConnectionResetException;
import org.apache.cocoon.Cocoon;
***************
*** 50,55 ****
--- 52,58 ----
import java.lang.reflect.Constructor;
import java.net.URL;
import java.util.Arrays;
+ import java.util.HashMap;
import java.util.StringTokenizer;
/**
***************
*** 58,64 ****
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
* @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>
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Leo Sutic</a>
--- 61,67 ----
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Leo Sutic</a>
***************
*** 585,598 ****
if (this.cocoon == null) {
res.setStatus(res.SC_INTERNAL_SERVER_ERROR);
! Notification n = new Notification(this, this.exception);
! n.setType("internal-servlet-error");
n.setTitle("Internal servlet error");
n.setSource("Cocoon servlet");
! n.setMessage("Internal servlet error");
! n.setDescription("Cocoon was not initialized.");
n.addExtraDescription("request-uri", request.getRequestURI());
! res.setContentType(Notifier.notify(n, res.getOutputStream()));;
return;
}
--- 588,601 ----
if (this.cocoon == null) {
res.setStatus(res.SC_INTERNAL_SERVER_ERROR);
! Notification n= new Notification(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(Notifier.notify(n, res.getOutputStream()));
return;
}
***************
*** 647,660 ****
if (this.cocoon.process(env)) {
contentType = env.getContentType();
} else {
// means SC_NOT_FOUND
res.sendError(res.SC_NOT_FOUND);
! Notification n = new Notification(this);
! n.setType("resource-not-found");
n.setTitle("Resource not found");
n.setSource("Cocoon servlet");
! n.setMessage("Resource not found");
n.setDescription("The requested URI \""
+ request.getRequestURI()
+ "\" was not found.");
--- 650,664 ----
if (this.cocoon.process(env)) {
contentType = env.getContentType();
} else {
+ // Should not get here!
// means SC_NOT_FOUND
res.sendError(res.SC_NOT_FOUND);
! Notification n= new Notification(this);
! n.setType("error");
n.setTitle("Resource not found");
n.setSource("Cocoon servlet");
! n.setMessage("The requested resource not found.");
n.setDescription("The requested URI \""
+ request.getRequestURI()
+ "\" was not found.");
***************
*** 670,676 ****
}
res.sendError(res.SC_NOT_FOUND);
! Notification n = new Notification(this);
n.setType("resource-not-found");
n.setTitle("Resource not found");
n.setSource("Cocoon servlet");
--- 674,681 ----
}
res.sendError(res.SC_NOT_FOUND);
!
! Notification n= new Notification(this);
n.setType("resource-not-found");
n.setTitle("Resource not found");
n.setSource("Cocoon servlet");
***************
*** 683,695 ****
// send the notification but don't include it in the output stream
// as the status SC_NOT_FOUND is enough
res.setContentType(Notifier.notify(n, (OutputStream)null));
} catch (ConnectionResetException cre) {
if (log.isWarnEnabled()) {
log.warn("The connection was reset", cre);
}
! Notification n = new Notification(this);
! n.setType("resource-not-found");
n.setTitle("Resource not found");
n.setSource("Cocoon servlet");
n.setMessage("Resource not found");
--- 688,701 ----
// send the notification but don't include it in the output stream
// as the status SC_NOT_FOUND is enough
res.setContentType(Notifier.notify(n, (OutputStream)null));
+
} catch (ConnectionResetException cre) {
if (log.isWarnEnabled()) {
log.warn("The connection was reset", cre);
}
! Notification n= new Notification(this);
! n.setType("error");
n.setTitle("Resource not found");
n.setSource("Cocoon servlet");
n.setMessage("Resource not found");
***************
*** 706,717 ****
log.error("Problem with servlet", e);
}
//res.setStatus(res.SC_INTERNAL_SERVER_ERROR);
! Notification n = new Notification(this, e);
! n.setType("internal-server-error");
! n.setTitle("Internal server error");
! n.setSource("Cocoon servlet");
! n.addExtraDescription("request-uri", request.getRequestURI());
! n.addExtraDescription("path-info", uri);
res.setContentType(contentType = Notifier.notify(n,
res.getOutputStream()));
}
--- 712,725 ----
log.error("Problem with servlet", e);
}
//res.setStatus(res.SC_INTERNAL_SERVER_ERROR);
!
! HashMap extraDescriptions = new HashMap(2);
! extraDescriptions.put("request-uri", request.getRequestURI());
! extraDescriptions.put("path-info", uri);
!
! Notificable n=NotificableBuilderFactory.builder(this).build(
! this, e, "fatal","Internal server error","Cocoon
servlet",null,null,extraDescriptions);
!
res.setContentType(contentType = Notifier.notify(n,
res.getOutputStream()));
}
*** src/org/apache/cocoon/sitemap/ErrorNotifier.java 2001/10/11 08:56:15 1.2.2.4
--- src/org/apache/cocoon/sitemap/ErrorNotifier.java 2001/12/09 11:47:55
***************
*** 9,23 ****
package org.apache.cocoon.sitemap;
import org.apache.avalon.excalibur.pool.Recyclable;
! import org.apache.cocoon.Notification;
! import org.apache.cocoon.Notifier;
import org.apache.cocoon.generation.ComposerGenerator;
import org.xml.sax.SAXException;
/**
* Generates an XML representation of the current notification.
*
! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @created 31 July 2000
* @version CVS $Revision: 1.2.2.4 $ $Date: 2001/10/11 08:56:15 $
--- 9,25 ----
package org.apache.cocoon.sitemap;
import org.apache.avalon.excalibur.pool.Recyclable;
! import org.apache.cocoon.notification.Notification;
! import org.apache.cocoon.notification.NotificableBuilderFactory;
! import org.apache.cocoon.notification.Notificable;
! import org.apache.cocoon.notification.Notifier;
import org.apache.cocoon.generation.ComposerGenerator;
import org.xml.sax.SAXException;
/**
* Generates an XML representation of the current notification.
*
! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @created 31 July 2000
* @version CVS $Revision: 1.2.2.4 $ $Date: 2001/10/11 08:56:15 $
***************
*** 26,51 ****
/**
* The <code>Notification</code> to report.
*/
! private Notification notification = null;
/**
- * Set the Exception to report.
- *
- * @param exception The Exception to report
- */
- public void setException(Throwable throwable) {
- notification = new Notification(this, throwable);
- notification.setTitle("Error creating the resource");
- }
-
- /**
* Set the Notification to report.
*
* @param exception The Exception to report
*/
! public void setNotification(Object o) {
! notification = new Notification(this, o);
! notification.setTitle("Error creating the resource");
}
/**
--- 28,49 ----
/**
* The <code>Notification</code> to report.
*/
! private Notificable notification = null;
/**
* Set the Notification to report.
*
* @param exception The Exception to report
*/
! public void setThrowable(Throwable throwable) {
! if(throwable instanceof Notificable)
! {
! this.notification = (Notificable)throwable;
! }
! else
! {
! notification = NotificableBuilderFactory.builder(this).build(this,
throwable);
! }
}
/**
*** src/org/apache/cocoon/transformation/TraxTransformer.java 2001/11/15 11:20:40
1.15.2.20
--- src/org/apache/cocoon/transformation/TraxTransformer.java 2001/12/09 11:48:00
***************
*** 20,25 ****
--- 20,26 ----
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.Constants;
import org.apache.cocoon.ProcessingException;
+ import org.apache.cocoon.notification.NotificableCascadingRuntimeException;
import org.apache.cocoon.caching.CacheValidity;
import org.apache.cocoon.caching.Cacheable;
import org.apache.cocoon.caching.TimeStampCacheValidity;
***************
*** 165,171 ****
this.useBrowserCap = child.getValueAsBoolean(false);
this._useBrowserCap = this.useBrowserCap;
getLogger().debug("Use browser capabilities is " + this.useBrowserCap + "
for " + this);
!
child = conf.getChild("use-session-info");
this.useSessionInfo = child.getValueAsBoolean(false);
this._useSessionInfo = this.useSessionInfo;
--- 166,172 ----
this.useBrowserCap = child.getValueAsBoolean(false);
this._useBrowserCap = this.useBrowserCap;
getLogger().debug("Use browser capabilities is " + this.useBrowserCap + "
for " + this);
!
child = conf.getChild("use-session-info");
this.useSessionInfo = child.getValueAsBoolean(false);
this._useSessionInfo = this.useSessionInfo;
***************
*** 175,181 ****
child = conf.getChild("xslt-processor-role");
String xsltRole = child.getValue(XSLTProcessor.ROLE);
getLogger().debug("Use XSLTProcessor of role " + xsltRole);
!
try {
this.xsltProcessor = (XSLTProcessor)this.manager.lookup(xsltRole);
} catch(Exception e) {
--- 176,182 ----
child = conf.getChild("xslt-processor-role");
String xsltRole = child.getValue(XSLTProcessor.ROLE);
getLogger().debug("Use XSLTProcessor of role " + xsltRole);
!
try {
this.xsltProcessor = (XSLTProcessor)this.manager.lookup(xsltRole);
} catch(Exception e) {
***************
*** 276,282 ****
= xsltProcessor.getTransformerHandler(inputSource);
} catch (Exception e){
getLogger().error("Problem in getTransformer:", e);
! throw new RuntimeException("Problem in getTransformer:" +
e.getMessage());
}
HashMap map = getLogicSheetParameters();
--- 277,283 ----
= xsltProcessor.getTransformerHandler(inputSource);
} catch (Exception e){
getLogger().error("Problem in getTransformer:", e);
! throw new NotificableCascadingRuntimeException("I wasn't able to get the
transformerHandler.", e);
}
HashMap map = getLogicSheetParameters();
*** webapp/stylesheets/system/error2html.xsl 2001/08/15 03:31:19 1.2.2.1
--- webapp/stylesheets/system/error2html.xsl 2001/12/09 11:48:04
***************
*** 1,4 ****
--- 1,5 ----
<?xml version="1.0"?>
+ <!-- Author: Nicola Ken Barozzi "[EMAIL PROTECTED]" -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
***************
*** 8,31 ****
<html>
<head>
<title>
! <xsl:value-of select="@type"/>:<xsl:value-of select="error:title"/>
</title>
</head>
! <body bgcolor="#ffffff">
! <table border="0" bgcolor="#000000" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td bgcolor="#0086b2" colspan="2">
! <font color="#ffffff" face="arial,helvetica,sanserif" size="+2">
<xsl:value-of select="error:title"/>
</font>
</td>
</tr>
<tr>
<td bgcolor="#0086b2" valign="top">
! <font color="#ffffff" face="arial,helvetica,sanserif" size="+1">
! <xsl:value-of select="@type"/>
</font>
</td>
<td bgcolor="#ffffff" >
--- 9,81 ----
<html>
<head>
<title>
! <xsl:value-of select="@error:type"/>:<xsl:value-of select="error:title"/>
</title>
+ <style><![CDATA[
+ <!--
+ H1{font-family : sans-serif,Arial,Tahoma;color : white;background-color :
+#0086b2;}
+ BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color :
+white;}
+ TABLE{font-family : sans-serif,Arial,Tahoma;color : black;background-color :
+black;}
+ B{color : white;background-color : #0086b2;}
+ HR{color : #0086b2;}
+ //-->]]>
+ </style>
+ <script language="JavaScript1.2"><![CDATA[
+ <!--
+ var head="display:''"
+ function expand(whatToExpand)
+ {
+ var head=whatToExpand.style
+ if (head.display=="none"){
+ head.display=""
+ }
+ else{
+ head.display="none"
+ }
+ }
+ //-->]]>
+ </script>
</head>
! <body>
! <table align="center" border="0" bgcolor="#000000" cellpadding="0"
cellspacing="0">
<tbody>
<tr>
+ <td>
+
+
+ <table align="center" border="0" bgcolor="#000000" cellpadding="2"
+cellspacing="2">
+ <tbody>
+ <tr>
<td bgcolor="#0086b2" colspan="2">
! <font color="#ffffff" size="+2">
<xsl:value-of select="error:title"/>
</font>
</td>
</tr>
<tr>
+ <td bgcolor="#ffffff" colspan="2" valign="top">
+ <font color="#000000">
+ The <xsl:value-of select="@error:sender"/> notifies that
+ <xsl:value-of select="error:source"/> says:<br/><br/>
+ <i><xsl:call-template name="returns2br">
+ <xsl:with-param name="string" select="error:message"/>
+ </xsl:call-template></i><br/><br/>
+ More precisly:<br/><br/>
+ <i><xsl:call-template name="returns2br">
+ <xsl:with-param name="string" select="error:description"/>
+ </xsl:call-template></i><br/>
+ <br/>
+ </font>
+ </td>
+ </tr>
+
+ <!--
+
+ <tr>
<td bgcolor="#0086b2" valign="top">
! <font color="#ffffff" size="+1">
! <xsl:value-of select="@error:type"/>
</font>
</td>
<td bgcolor="#ffffff" >
***************
*** 35,58 ****
<tr>
<td bgcolor="#0086b2" valign="top" colspan="2">
! <font color="#ffffff" face="arial,helvetica,sanserif" size="+1">details</font>
</td>
</tr>
<tr>
<td bgcolor="#0086b2" valign="top">
! <font face="arial,helvetica,sanserif" color="#ffffff">from</font>
</td>
<td bgcolor="#ffffff">
<font face="arial,helvetica,sanserif">
! <xsl:value-of select="@sender"/>
</font>
</td>
</tr>
<tr>
<td bgcolor="#0086b2" valign="top">
! <font face="arial,helvetica,sanserif" color="#ffffff">source</font>
</td>
<td bgcolor="#ffffff">
<font face="arial,helvetica,sanserif">
--- 85,108 ----
<tr>
<td bgcolor="#0086b2" valign="top" colspan="2">
! <font color="#ffffff" size="+1">details</font>
</td>
</tr>
<tr>
<td bgcolor="#0086b2" valign="top">
! <font color="#ffffff">from</font>
</td>
<td bgcolor="#ffffff">
<font face="arial,helvetica,sanserif">
! <xsl:value-of select="@error:sender"/>
</font>
</td>
</tr>
<tr>
<td bgcolor="#0086b2" valign="top">
! <font color="#ffffff">source</font>
</td>
<td bgcolor="#ffffff">
<font face="arial,helvetica,sanserif">
***************
*** 62,78 ****
</tr>
<xsl:apply-templates select="error:description"/>
!
<tr>
<td bgcolor="#0086b2" valign="top" colspan="2">
! <font color="#ffffff" face="arial,helvetica,sanserif" size="+1">extra
info</font>
</td>
</tr>
<xsl:apply-templates select="error:extra"/>
!
</tbody>
</table>
</body>
</html>
</xsl:template>
--- 112,170 ----
</tr>
<xsl:apply-templates select="error:description"/>
! -->
<tr>
<td bgcolor="#0086b2" valign="top" colspan="2">
! <font color="#ffffff" size="+1">extra info</font>
</td>
</tr>
<xsl:apply-templates select="error:extra"/>
!
! <tr>
! <td bgcolor="#ffffff" colspan="2" valign="top">
! <font color="#000000" size="-1">
! <br/>
! If you need help and this information is not enough, you
! are invited to read the <a
href="http://xml.apache.org/cocoon/faq.html">cocoon faq</a>.<br/>
! If you still don't find the answers you need,
! can send a mail to the
! <a>
! <xsl:attribute
name="href">mailto:[EMAIL PROTECTED]?subject=[HELP]<xsl:value-of
select="error:message"/>&body=Description:<xsl:value-of
select="error:description"/></xsl:attribute>
! Cocoon users mailing list</a>,
! remembering to
! <ul>
! <li> specify the version of Cocoon you're using, or we suppose that you
! are talking about the latest version;</li>
! <li>specify the taglibs and sitemap components that are pertinent;</li>
! <li>specify the platform-operating system-version-servlet container
version;</li>
! <li>send any pertinent error message;</li>
! <li>send pertinent log snippets;</li>
! <li>send pertinent sitemap snippets;</li>
! <li>send pertinent parts of the page that gives you problems.</li>
! </ul>
! For more detailed technical information, take a look at the log
! files in the log directory of cocoon, which is <code>/WEB-INF/logs</code> by
default.<br/>
! Logging configuration is by default in
<code>/WEB-INF/logkit.xconf.</code><br/><br/>
! If you think you found a bug, please report it al
! <a href="http://nagoya.apache.org/bugzilla/">Apache's Bugzilla</a>;
! a message will be sent to the developer mailing list.<br/>
! </font>
! </td>
! </tr>
!
</tbody>
</table>
+
+
+
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
</body>
</html>
</xsl:template>
***************
*** 83,114 ****
<font color="#ffffff" face="arial,helvetica,sanserif">description</font>
</td>
<td bgcolor="#ffffff">
! <font face="arial,helvetica,sanserif">
! <xsl:value-of select="."/>
! </font>
</td>
</tr>
</xsl:template>
<xsl:template match="error:message">
! <font face="arial,helvetica,sanserif">
! <xsl:value-of select="."/>
! </font>
</xsl:template>
<xsl:template match="error:extra">
<tr>
<td bgcolor="#0086b2" valign="top">
! <font color="#ffffff" face="arial,helvetica,sanserif">
! <xsl:value-of select="@description"/>
</font>
! </td>
<td bgcolor="#ffffff">
! <xsl:variable name="x" select="translate(.,' ',' ')"/>
! <pre>
! <xsl:value-of select="$x"/>
! </pre>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
--- 175,238 ----
<font color="#ffffff" face="arial,helvetica,sanserif">description</font>
</td>
<td bgcolor="#ffffff">
! <xsl:call-template name="returns2br">
! <xsl:with-param name="string" select="."/>
! </xsl:call-template>
</td>
</tr>
</xsl:template>
<xsl:template match="error:message">
! <xsl:call-template name="returns2br">
! <xsl:with-param name="string" select="."/>
! </xsl:call-template>
</xsl:template>
<xsl:template match="error:extra">
<tr>
<td bgcolor="#0086b2" valign="top">
! <font color="#ffffff">
! <xsl:value-of select="@error:description"/>
</font>
! </td>
<td bgcolor="#ffffff">
! <font size="-1">
! <xsl:choose>
! <xsl:when test="contains(@error:description,'stacktrace')">
! <!-- degrade gracefully on Netscape-->
! <a href="javascript:"
onclick="expand(document.all[this.sourceIndex+2])"><script>if(document.all){document.write('show');}</script></a>
! <div style="display:'none';">
! <xsl:call-template name="returns2br">
! <xsl:with-param name="string" select="."/>
! </xsl:call-template>
! </div>
! </xsl:when>
! <xsl:otherwise>
! <xsl:call-template name="returns2br">
! <xsl:with-param name="string" select="."/>
! </xsl:call-template>
! </xsl:otherwise>
! </xsl:choose>
! </font>
</td>
</tr>
</xsl:template>
+
+ <xsl:template name="returns2br">
+ <xsl:param name="string"/>
+ <xsl:variable name="return" select="'
'"/>
+ <xsl:choose>
+ <xsl:when test="contains($string,$return)">
+ <xsl:value-of select="substring-before($string,$return)"/>
+ <br/>
+ <xsl:call-template name="returns2br">
+ <xsl:with-param name="string" select="substring-after($string,$return)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]