On Wed, 4 Jan 2023 10:00:51 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> Hi Alan, I adjusted this coding following your suggestion to use 
>> setStackTrace.
>
>> Hi Alan, I adjusted this coding following your suggestion to use 
>> setStackTrace.
> 
> That's just one of them. In a later comment I pasted in asSocketException and 
> changed all 4 cases to use it, maybe you could try that. The right thing is 
> of course to drop the translation to SocketException as anything using 
> read/write has to deal with IOException anyway, it's really just a concern 
> that older code may having special handling of SocketException of 
> undocumented, but longstanding, behavior in older JDK releases.

Sorry Alan, seems I somehow missed that. I pushed a new commit including 
asSocketException  .


I wonder, could asSocketException  in the form of asOtherException maybe be a 
useful generics that covers multiple exception classes (but that would be 
something for another PR) ?

public static <T extends Exception> T asOtherException(Exception e, T n) {
    ...
}

(maybe we could omit the second param somehow, not sure.)

-------------

PR: https://git.openjdk.org/jdk/pull/11813

Reply via email to