sylvain 01/10/17 03:05:53
Modified: . Tag: cocoon_20_branch changes.xml
src/org/apache/cocoon Tag: cocoon_20_branch
Notification.java
src/org/apache/cocoon/components/language/generator Tag:
cocoon_20_branch GeneratorSelector.java
src/org/apache/cocoon/components/language/markup/sitemap/java
Tag: cocoon_20_branch sitemap.xsl
src/org/apache/cocoon/sitemap Tag: cocoon_20_branch
Handler.java Manager.java
Log:
Reduce exception nesting in case of sitemap setup errors, and display all
nested exceptions in the error page (avoids searching the logs for the failure
cause)
Revision Changes Path
No revision
No revision
1.2.2.41 +12 -1 xml-cocoon2/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/changes.xml,v
retrieving revision 1.2.2.40
retrieving revision 1.2.2.41
diff -u -r1.2.2.40 -r1.2.2.41
--- changes.xml 2001/10/16 12:26:39 1.2.2.40
+++ changes.xml 2001/10/17 10:05:52 1.2.2.41
@@ -4,7 +4,7 @@
<!--
History of Cocoon changes
- $Id: changes.xml,v 1.2.2.40 2001/10/16 12:26:39 cziegeler Exp $
+ $Id: changes.xml,v 1.2.2.41 2001/10/17 10:05:52 sylvain Exp $
-->
<changes title="History of Changes">
@@ -26,6 +26,17 @@
</devs>
<release version="@version@" date="@date@">
+ <action dev="SW" type="fix">
+ Reduce exception nesting in case of sitemap setup errors, and display
all nested exceptions
+ in the error page (avoids searching the logs for the failure cause).
+ </action>
+ <action dev="SW" type="update">
+ Added attribute management methods to environment Context and its
implementations.
+ </action>
+ <action dev="SW" type="update">
+ Updated TraxTransformer and XSLTProcessor to allow simultaneous use of
several
+ TRAX processors (e.g. xalan and saxon) in a controlled way.
+ </action>
<action dev="CZ" type="fix">
Updated session handling of commandline interface and fixed
parameter handling.
No revision
No revision
1.2.2.5 +38 -4 xml-cocoon2/src/org/apache/cocoon/Notification.java
Index: Notification.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Notification.java,v
retrieving revision 1.2.2.4
retrieving revision 1.2.2.5
diff -u -r1.2.2.4 -r1.2.2.5
--- Notification.java 2001/10/11 08:56:04 1.2.2.4
+++ Notification.java 2001/10/17 10:05:53 1.2.2.5
@@ -106,15 +106,25 @@
} else {
stackTraceException = t;
}
- StringWriter stackTrace = new StringWriter();
- stackTraceException.printStackTrace(new PrintWriter(stackTrace));
- extraDescriptions.put("stacktrace", stackTrace.toString());
+ StringWriter sw = new StringWriter();
+ stackTraceException.printStackTrace(new PrintWriter(sw));
+ extraDescriptions.put("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) {
+ extraDescriptions.put("original exception", causes);
+ }
+
+/* Now handled by appendCauses()
// if the throwable is a CascadingThrowable the strack trace
// is automatically appended by the CascadingThrowable, so we
// only have to deal with the case if the embedded exception
// of the CascadingThrowable is a SAXException.
- if (t instanceof CascadingThrowable) {
+ if (t instanceof CascadingThrowable) {
Throwable cause = ((CascadingThrowable)t).getCause();
if(cause != null && cause instanceof SAXException) {
cause = ((SAXException)cause).getException();
@@ -126,6 +136,30 @@
}
}
}
+*/
+ }
+ }
+
+ /**
+ * Print recursively all nested causes of a Throwable in a PrintWriter.
+ */
+ public 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);
}
}
No revision
No revision
1.1.1.1.2.12 +6 -12
xml-cocoon2/src/org/apache/cocoon/components/language/generator/GeneratorSelector.java
Index: GeneratorSelector.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/generator/GeneratorSelector.java,v
retrieving revision 1.1.1.1.2.11
retrieving revision 1.1.1.1.2.12
diff -u -r1.1.1.1.2.11 -r1.1.1.1.2.12
--- GeneratorSelector.java 2001/10/11 08:56:06 1.1.1.1.2.11
+++ GeneratorSelector.java 2001/10/17 10:05:53 1.1.1.1.2.12
@@ -28,7 +28,7 @@
* includes Sitemaps and XSP Pages
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.1.1.2.11 $ $Date: 2001/10/11 08:56:06 $
+ * @version CVS $Revision: 1.1.1.1.2.12 $ $Date: 2001/10/17 10:05:53 $
*/
public class GeneratorSelector extends ExcaliburComponentSelector implements
Disposable {
@@ -112,19 +112,15 @@
}
}
- private void addGenerator(Object hint) throws ComponentException {
+ private void addGenerator(Object hint) throws Exception {
Class generator;
String className = hint.toString().replace(File.separatorChar, '.');
- try {
- generator = this.classManager.loadClass(className);
- } catch (Exception e) {
- throw new ComponentException("Could not add component for class:
" + className, e);
- }
+ generator = this.classManager.loadClass(className);
this.addGenerator(this.manager, hint, generator);
}
- protected void addGenerator(ComponentManager newManager, Object hint,
Class generator) throws ComponentException {
+ protected void addGenerator(ComponentManager newManager, Object hint,
Class generator) throws Exception {
try
{
final ComponentHandler handler =
@@ -142,10 +138,8 @@
}
catch( final Exception e )
{
- final String message =
- "Could not set up Component for hint: " + hint;
- getLogger().error( message, e);
- throw new ComponentException( message, e );
+ getLogger().error("Could not set up Component for hint: " +
hint, e);
+ throw e;
}
}
No revision
No revision
1.11.2.35 +2 -2
xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
Index: sitemap.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
retrieving revision 1.11.2.34
retrieving revision 1.11.2.35
diff -u -r1.11.2.34 -r1.11.2.35
--- sitemap.xsl 2001/10/12 09:32:14 1.11.2.34
+++ sitemap.xsl 2001/10/17 10:05:53 1.11.2.35
@@ -124,7 +124,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo
Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin
Loritsch</a>
- * @version CVS $Id: sitemap.xsl,v 1.11.2.34 2001/10/12 09:32:14
cziegeler Exp $
+ * @version CVS $Id: sitemap.xsl,v 1.11.2.35 2001/10/17 10:05:53 sylvain
Exp $
*/
public class <xsl:value-of select="@file-name"/> extends AbstractSitemap
{
static final String LOCATION = "<xsl:value-of
select="translate(@file-path, '/', '.')"/>.<xsl:value-of select="@file-name"/>";
@@ -259,7 +259,7 @@
/* catch any exception thrown by a component during configuration */
} catch (Exception e) {
getLogger().warn(e.getMessage(), e);
- throw new ConfigurationException ("Sitemap: " + e.getMessage(), e);
+ throw new ConfigurationException ("Error in sitemap configuration
: " + e.getMessage(), e);
}
}
No revision
No revision
1.9.2.16 +2 -5 xml-cocoon2/src/org/apache/cocoon/sitemap/Handler.java
Index: Handler.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Handler.java,v
retrieving revision 1.9.2.15
retrieving revision 1.9.2.16
diff -u -r1.9.2.15 -r1.9.2.16
--- Handler.java 2001/10/11 08:56:15 1.9.2.15
+++ Handler.java 2001/10/17 10:05:53 1.9.2.16
@@ -41,7 +41,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.9.2.15 $ $Date: 2001/10/11 08:56:15 $
+ * @version CVS $Revision: 1.9.2.16 $ $Date: 2001/10/17 10:05:53 $
*/
public class Handler extends AbstractLoggable
implements Runnable, Contextualizable, Composable, Processor, Disposable,
SourceResolver {
@@ -238,10 +238,7 @@
public void throwEventualException() throws Exception {
if (this.exception != null) {
- if(this.exception instanceof ProcessingException)
- throw this.exception;
- else
- throw new ProcessingException("Exception in Handler",
this.exception);
+ throw this.exception;
}
}
1.2.2.17 +7 -4 xml-cocoon2/src/org/apache/cocoon/sitemap/Manager.java
Index: Manager.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Manager.java,v
retrieving revision 1.2.2.16
retrieving revision 1.2.2.17
diff -u -r1.2.2.16 -r1.2.2.17
--- Manager.java 2001/10/11 08:56:15 1.2.2.16
+++ Manager.java 2001/10/17 10:05:53 1.2.2.17
@@ -34,7 +34,7 @@
* checking regeneration of the sub <code>Sitemap</code>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.2.2.16 $ $Date: 2001/10/11 08:56:15 $
+ * @version CVS $Revision: 1.2.2.17 $ $Date: 2001/10/17 10:05:53 $
*/
public class Manager
extends AbstractLoggable
@@ -238,9 +238,12 @@
private void setupProcessing(Environment environment, Handler
sitemapHandler, String uri_prefix,
String source) throws Exception {
if (!sitemapHandler.available()) {
- throw new ProcessingException("The sitemap handler's sitemap
is not available. " +
- "Please check logs for the exact error.",
- sitemapHandler.getException());
+ if (sitemapHandler.getException() != null) {
+ throw sitemapHandler.getException();
+ } else {
+ throw new ProcessingException("The sitemap handler's
sitemap is not available. " +
+ "Please check logs for the exact error.");
+ }
}
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]