-
Bug
-
Resolution: Fixed
-
P3
-
6u14
-
b01
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Upgrading to this release has caused the following code to fail:
Exception cause = new Exception();
SAXException e = new SAXException("A SAX exception");
e.initCause(cause);
System.out.println(cause == e.getCause());
Using 6u14 this now prints "false" because initCause(Throwable t); is not overriden in SAXException.
Taking a step back though, why do you need to store the Exception in SAXException? Why can you not simply delegate all calls to Throwable? I see no logic that SAXException adds on top of Throwable, it just provides a getException() method.
It seems it last worked under:
Java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode)
I've also tried a few other earlier ones (1.6.0_11, 1.6.0_06, 1.5.0_17)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Exception cause = new Exception();
SAXException e = new SAXException("A SAX exception");
e.initCause(cause);
System.out.println(cause == e.getCause());
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should output: "true"
ACTUAL -
outputs "false"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import org.xml.sax.SAXException;
public class Test {
public static void main(String[] args) {
Exception cause = new Exception();
SAXException e = new SAXException("A SAX exception");
e.initCause(cause);
System.out.println(cause == e.getCause());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Do not use the initCause();
Release Regression From : 6u13
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Upgrading to this release has caused the following code to fail:
Exception cause = new Exception();
SAXException e = new SAXException("A SAX exception");
e.initCause(cause);
System.out.println(cause == e.getCause());
Using 6u14 this now prints "false" because initCause(Throwable t); is not overriden in SAXException.
Taking a step back though, why do you need to store the Exception in SAXException? Why can you not simply delegate all calls to Throwable? I see no logic that SAXException adds on top of Throwable, it just provides a getException() method.
It seems it last worked under:
Java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode)
I've also tried a few other earlier ones (1.6.0_11, 1.6.0_06, 1.5.0_17)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Exception cause = new Exception();
SAXException e = new SAXException("A SAX exception");
e.initCause(cause);
System.out.println(cause == e.getCause());
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should output: "true"
ACTUAL -
outputs "false"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import org.xml.sax.SAXException;
public class Test {
public static void main(String[] args) {
Exception cause = new Exception();
SAXException e = new SAXException("A SAX exception");
e.initCause(cause);
System.out.println(cause == e.getCause());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Do not use the initCause();
Release Regression From : 6u13
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
- relates to
-
JDK-6809409 jaxp Issue 56 SAXException doesn't do the exception chaining properly
- Closed
-
JDK-6385694 SAXException doesn't handle exception nesting
- Closed
- links to