mirror of
https://github.com/apache/xmlgraphics-fop.git
synced 2024-09-14 00:01:49 +02:00
Attach cause to RuntimeException when available. Otherwise, the original exception can be swallowed which makes error forensics more difficult.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@819205 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b4df075d6d
commit
2d26284592
@ -58,7 +58,21 @@ public class EventExceptionManager {
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user