Adding SocketChannel toString to connection exception messages
david.lloyd at redhat.com
Wed Jan 3 13:47:00 UTC 2018
On Fri, Dec 29, 2017 at 11:15 AM, Chris Hegarty
<chris.hegarty at oracle.com> wrote:
> On 29 Dec 2017, at 00:33, Steven Schlansker <stevenschlansker at gmail.com> wrote:
>> Thanks for the discussion!
>> So, it sounds like amending the message by default is going to be a non-starter -- but at least adding the information otherwise might be possible.
>> One possibility would be to add new fields to SocketException, for example an InetSocketAddress representing both the local and remote (if available).
> You would need to careful to not disclose resolved addresses to untrusted code. SocketException, since a subtype of IOException, can wind up in many places.
> Would you be proposing to add these new fields to the serial-form of SocketException? What behaviour do you envisage for deserializing instances from previous releases? This will have an impact of any potential API.
This is an advantage to a setter-only message supplement method: if
the supplementary field is set, the writeReplace method can swap it
for a new instance with the combined message.
More information about the core-libs-dev