java.net.BindException doesn't include host info even when jdk.includeInExceptions is set to hostInfo

Alan Bateman Alan.Bateman at oracle.com
Thu Jun 11 13:48:21 UTC 2020


On 11/06/2020 14:31, Jaikiran Pai wrote:
> The security.properties file in Java 11 (and later) have a new
> configuration:
>
> # The categories are:
> #
> #  hostInfo - IOExceptions thrown by java.net.Socket and the socket
> types in the
> #             java.nio.channels package will contain enhanced exception
> #             message information
> #
> # The property setting in this file can be overridden by a system
> property of
> # the same name, with the same syntax and possible values.
> #
> #jdk.includeInExceptions=hostInfo
>
> As noted for that property, if hostInfo is set as a value for this
> jdk.includeInExceptions then IOException thrown by java.net.Socket will
> container additional information. Is this expected to work for all kinds
> of connection issues related to Socket types? For example, I have a Java
> program which creates a ServerSocket and (intentionally) binds it to
> port which is already in use. I (as expected) keep seeing this exception:
>
It's only used when when when connecting a stream-oriented socket fails. 
It could be extended of course although I would expect most servers have 
some form of log so the information on the local address/port might be 
there already.!

-Alan.


More information about the net-dev mailing list