This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: FYI: NetworkInterface.getInetAddresses() fix


Tom Tromey wrote:
> >>>>> "Gary" == Gary Benson <gbenson@redhat.com> writes:
> 
> Gary> This commit makes NetworkInterface.getInetAddresses()
> Gary> bracket IPv6 addresses before calling SecurityManager.
> Gary> checkConnect() with them.  This fixes
> Gary> http://gcc.gnu.org/ml/java/2006-08/msg00082.html.
> 
> I'm curious about one aspect of this patch...
> 
> Gary> +	    String hostAddress = addr.getHostAddress();
> Gary> +	    if (addr instanceof Inet6Address)
> Gary> +	      hostAddress = "[" + hostAddress + "]";
> 
> This is un-OO-like, which raises a warning flag for me.
> I was wondering whether the brackets ought to be added in
> Inet6Address.getHostAddress... ?

Inet6Address.getHostAddress() definitly doesn't add the brackets --
see the javadoc for java.net.SocketPermission.  However, it seems that
proprietary JVMs support the creation of SocketPermissions with non-
bracketed IPv6 addresses, an extension of the spec.  So I guess we
ought to be doing that too :/

Cheers,
Gary


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]