I've seen code that wraps InterruptedException in some other exception
prior to throwing that other exception; for example:

    catch (InterruptedException e) {
        throw new IOException(e);
    }

I wonder if there are any legitimate cases for this, because I cannot
think of any. In my mind, it's always InterruptedException itself that
should be thrown; and if it cannot be done, then the interrupted
status should be set.

This is because if code that catches exceptions expects
InterruptedException, it expects to catch it directly rather than
search the exception graph (i.e. cause/suppressed) of the caught
exception for InterruptedException.

-Pavel

Reply via email to