Code Review Request: 6978200 ServerSocket.toString include "port=0" in the returned String
Chris Hegarty
chris.hegarty at oracle.com
Fri Jul 29 02:24:04 PDT 2011
This change looks fine to me. Thanks Kurchi,
-Chris.
On 7/28/2011 10:29 PM, Kurchi Hazra wrote:
> Hi,
>
> The ServerSocket.toString method returns a string that, besides the
> ServerSocket's local port information, also contains "port=0". For
> example: "ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=7005]".
>
> The fix aims at modifying the string returned by the toString method
> by removing impl.getPort() from the method and subsequently "port=0"
> from it. Although we know that anyone parsing toString (and ignoring
> port) may suffer from this change, but we don't expect that many (if
> anyone ) is doing this since accessor methods provide easier access to
> the local address and port.
>
> The fix involves updates in:
> jdk/src/share/classes/java/net/ServerSocket.java
>
>
>
> I am posting the output of hg diff here:
>
> bash-3.00$ hg diff src/share/classes/java/net/ServerSocket.java
> diff -r a80562f7ea50 src/share/classes/java/net/ServerSocket.java
> --- a/src/share/classes/java/net/ServerSocket.java Wed Jul 27
> 18:10:10 2011 +0100
> +++ b/src/share/classes/java/net/ServerSocket.java Thu Jul 28
> 14:16:10 2011 -0700
> @@ -716,7 +716,6 @@ class ServerSocket implements java.io.Cl
> if (!isBound())
> return "ServerSocket[unbound]";
> return "ServerSocket[addr=" + impl.getInetAddress() +
> - ",port=" + impl.getPort() +
> ",localport=" + impl.getLocalPort() + "]";
> }
>
>
> Thanks!
>
More information about the net-dev
mailing list