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: [email protected]
For additional commands, e-mail: [email protected]