You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2009/09/26 22:38:35 UTC
svn commit: r819205 -
/xmlgraphics/fop/trunk/src/java/org/apache/fop/events/EventExceptionManager.java
Author: jeremias
Date: Sat Sep 26 20:38:23 2009
New Revision: 819205
URL: http://svn.apache.org/viewvc?rev=819205&view=rev
Log:
Attach cause to RuntimeException when available. Otherwise, the original exception can be swallowed which makes error forensics more difficult.
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/events/EventExceptionManager.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/events/EventExceptionManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/events/EventExceptionManager.java?rev=819205&r1=819204&r2=819205&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/events/EventExceptionManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/events/EventExceptionManager.java Sat Sep 26 20:38:23 2009
@@ -58,7 +58,21 @@
}
} else {
String msg = EventFormatter.format(event);
- throw new RuntimeException(msg);
+ //Get original exception as cause if it is given as one of the parameters
+ Throwable t = null;
+ Iterator iter = event.getParams().values().iterator();
+ while (iter.hasNext()) {
+ Object o = iter.next();
+ if (o instanceof Throwable) {
+ t = (Throwable)o;
+ break;
+ }
+ }
+ if (t != null) {
+ throw new RuntimeException(msg, t);
+ } else {
+ throw new RuntimeException(msg);
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org