JDK-6405072 : IOException subclasses lacks some constructors
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 5.0,6
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000,windows_xp
  • CPU: x86
  • Submitted: 2006-03-28
  • Updated: 2013-04-04
  • Resolved: 2012-10-25
Related Reports
Duplicate :  
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
Since Java 1.4, java.lang.Exception have 2 new constructors:
public Exception(Throwable cause)
public Exception(String message, Throwable cause)

java.io.IOException (and subclasses) lacks those new constructors, thus preventing "usefull" subclassing.

JUSTIFICATION :
Catching nested exceptions are a usefull way to convey information in case of error. All exception (and error) classes from the JRE should include all 4 constructors.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the following constructors to be available:
public IOException()
public IOException(String s)
public IOException(Throwable cause)
public IOException(String message, Throwable cause)
ACTUAL -
The only available constructors are:
public IOException()
public IOException(String s)

CUSTOMER SUBMITTED WORKAROUND :
no workaround

Comments
I've decided to close this bug because these constructors were added to IOException in Java SE 6. If there are other sub-types of IOException that need addition constructors then separate issues should be created for them.
25-10-2012

EVALUATION Constructors to support exception chaining are being added to IOException as part of 5070673. There are a number of exceptions which extend IOException. Several of them are in other parts of the JDK so it is possible that there are already specific requests for some of this functionality.If there is a specific exception (besides IOException) which we should consider immediately, a JDC comment would be appreciated.
28-03-2006