Tags

From JPL 4h ed., chaining using initCause() which can only
be called once, else IllegalStateException.

eg.
try {
} catch (IOException e) {
    MyException mex = new MyException();
    mex.initCause(e);
    throw mex;

// or this, note initCause is Throwable,
// so, need to cast it back to MyException

    throw(MyException)new MyException().initCause(e);
} finally {
}

Advertisements