This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: Account for possible null laddr in Socket.java
- From: Mohan Embar <gnustuff at thisiscool dot com>
- To: Michael Koch <konqueror at gmx dot de>
- Cc: GCJ Patches <java-patches at gcc dot gnu dot org>
- Date: Sun, 15 Jun 2003 13:48:58 -0500
- Subject: Patch: Account for possible null laddr in Socket.java
- Reply-to: gnustuff at thisiscool dot com
Michael,
This fixes Socket.Socket(InetAddress, int, InetAddress, int, boolean) to
account for a possible laddr==null through a call from another overloaded
constructor, such as Socket.Socket(InetAddress, int).
Enjoy.
-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/
ChangeLog
2003-06-15 Mohan Embar <gnustuff@thisiscool.com>
* java/net/Socket.java:
(Socket(InetAddress, int, InetAddress, int, boolean)) account
for case where laddr is null via another constructor overload
Index: java/net/Socket.java
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/net/Socket.java,v
retrieving revision 1.23
diff -u -2 -r1.23 Socket.java
--- java/net/Socket.java 8 Jun 2003 10:12:09 -0000 1.23
+++ java/net/Socket.java 15 Jun 2003 18:34:40 -0000
@@ -291,5 +291,7 @@
// bind/connect socket
- bind (new InetSocketAddress (laddr, lport));
+ SocketAddress lbindpoint =
+ laddr == null ? null : new InetSocketAddress (laddr, lport);
+ bind (lbindpoint);
connect (new InetSocketAddress (raddr, rport));