Adding SocketChannel toString to connection exception messages
stevenschlansker at gmail.com
Fri Dec 22 00:59:37 UTC 2017
> On Dec 21, 2017, at 4:35 PM, David Holmes <david.holmes at oracle.com> wrote:
> On 22/12/2017 10:29 AM, Steven Schlansker wrote:
>>> On Dec 21, 2017, at 11:11 AM, Steven Schlansker <stevenschlansker at gmail.com> wrote:
>>> What if ConnectException included the attempted hostname / IP / port SocketAddress?
>>> java.net.ConnectException: Connection to 'foo.mycorp.com[10.x.x.x]:12345' refused
>>> Much more useful! This could also be extended to various other socket exceptions.
> I believe there are concerns with too much information that can be considered "sensitive" (like host names and IP addresses) appearing in error messages due to them ending up in log files and bug reports.
Unfortunately that's exactly the information that is crucial to someone trying to diagnose issues...
Could it be an opt-in policy? Perhaps by a system property?
Currently the alternative I'm faced with is going through every piece of user code and library that *might*
throw this exception and wrapping it to add this critical diagnostic information. For an application that uses
java.net heavily, you can imagine how that is a tall task and possibly even not realistically achievable...
(Is there a written policy regarding this somewhere, or is it up to the personal feelings of the contributors?)
More information about the core-libs-dev