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]

Patch: Account for possible null laddr in Socket.java


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));
 




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