Add more constructors in ClosedChannelException
aayush at ShieldBlaze.com
Tue Jan 24 06:23:35 UTC 2023
Link to Netty Issue:
Add `StacklessSSLHandshakeException` for `ClosedChannelException` by hyperxpro · Pull Request #13099 · netty/netty<https://github.com/netty/netty/pull/13099>
Motivation: When a channel is closed during the SSL handshake then java.nio.channels.ClosedChannelException is thrown. This is correct when we see it from a low-level transport perspective but from...
From: discuss <discuss-retn at openjdk.org> on behalf of Aayush Atharva <aayush at ShieldBlaze.com>
Sent: Tuesday, January 24, 2023 11:44 AM
To: discuss at openjdk.org <discuss at openjdk.org>
Subject: Add more constructors in ClosedChannelException
Hello JDK Community! 🙂
The current ClosedChannelException does not have any constructors to pass a message. We have to rely on 'initCause(...)' for passing extra messages regarding a ClosedChannelException but it's not a very good practice in my opinion. Because we will have to generate another Exception which will create another brand-new object in the heap and generates a stack trace. And all of this just to pass a simple message for ClosedChannelException.
When we log ClosedChannelException, we get something like this in our loggers:
Honestly, it's not helpful at all. Netty suffers from this same problem but we have added a new suppressed Stackless exception in ClosedChannelException which will help us give more context to users about the exception but this is really a workaround.
In my opinion, we can add extra constructors in ClosedChannelException which will accept messages and we can have a good exception at the end.
I'd like to have everyone's opinion on this and see how we can tackle this.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the discuss