Migrate a bug fix for printStackTrace which was done before the JAXP 1.3 integration
back to the head. git-svn-id: https://svn.apache.org/repos/asf/xml/commons/trunk@226231 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c3fa88a3b2
commit
57c5a282f3
@ -312,6 +312,18 @@ public class TransformerException extends Exception {
|
||||
super.printStackTrace(s);
|
||||
} catch (Throwable e) {}
|
||||
|
||||
boolean isJdk14OrHigher = false;
|
||||
try {
|
||||
Throwable.class.getMethod("getCause",null);
|
||||
isJdk14OrHigher = true;
|
||||
} catch (NoSuchMethodException nsme) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
// The printStackTrace method of the Throwable class in jdk 1.4
|
||||
// and higher will include the cause when printing the backtrace.
|
||||
// The following code is only required when using jdk 1.3 or lower
|
||||
if (!isJdk14OrHigher) {
|
||||
Throwable exception = getException();
|
||||
|
||||
for (int i = 0; (i < 10) && (null != exception); i++) {
|
||||
@ -357,6 +369,7 @@ public class TransformerException extends Exception {
|
||||
exception = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
// insure output is written
|
||||
s.flush();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user