A DESCRIPTION OF THE PROBLEM :
It is not possible to create a java.lang.ExceptionInInitializerError with both message and cause, the reasons for this are:
- Such a constructor is missing
- The constructor ExceptionInInitializerError(String) prevents usage of `initCause(...)`
Therefore it would be good to add a constructor `ExceptionInInitializerError(String message, Throwable cause)`.
Note that the documentation for `ExceptionInInitializerError` should be improved (and `initCause(...)` should be overridden to add documentation and mark it as @Deprecated?) to indicate that calling `initCause(...)` is never possible, regardless of which constructor is used.
---------- BEGIN SOURCE ----------
Exception cause = new Exception("Cause");
new ExceptionInInitializerError("Custom message").initCause(cause);
---------- END SOURCE ----------
It is not possible to create a java.lang.ExceptionInInitializerError with both message and cause, the reasons for this are:
- Such a constructor is missing
- The constructor ExceptionInInitializerError(String) prevents usage of `initCause(...)`
Therefore it would be good to add a constructor `ExceptionInInitializerError(String message, Throwable cause)`.
Note that the documentation for `ExceptionInInitializerError` should be improved (and `initCause(...)` should be overridden to add documentation and mark it as @Deprecated?) to indicate that calling `initCause(...)` is never possible, regardless of which constructor is used.
---------- BEGIN SOURCE ----------
Exception cause = new Exception("Cause");
new ExceptionInInitializerError("Custom message").initCause(cause);
---------- END SOURCE ----------
- relates to
-
JDK-4385429 exception chaining facility: serialization of some Exception classes broken
-
- Closed
-
-
JDK-8264148 Update spec for exceptions retrofitted for exception chaining
-
- Resolved
-