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]

FYI: Patch: gnu.java.nio.DatagramChannelImpl


Hi list,


I just commited the attached little fix to trunk.
It lets gnu.java.nio.DatagramChannelImpl throw an exception if the 
target is not resolvable.


Michael


2004-02-26  Michael Koch  <konqueror@gmx.de>

	* gnu/java/nio/DatagramChannelImpl.java
	(send): Check if target address is resolved.

Index: gnu/java/nio/DatagramChannelImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/DatagramChannelImpl.java,v
retrieving revision 1.9
diff -u -b -B -r1.9 DatagramChannelImpl.java
--- gnu/java/nio/DatagramChannelImpl.java	3 Feb 2004 16:07:24 -0000	1.9
+++ gnu/java/nio/DatagramChannelImpl.java	26 Feb 2004 17:16:44 -0000
@@ -1,5 +1,5 @@
 /* DatagramChannelImpl.java -- 
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,10 +38,11 @@
 
 package gnu.java.nio;
 
+import gnu.java.net.PlainDatagramSocketImpl;
 import java.io.IOException;
 import java.net.DatagramPacket;
 import java.net.DatagramSocket;
-import gnu.java.net.PlainDatagramSocketImpl;
+import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.net.SocketTimeoutException;
 import java.nio.ByteBuffer;
@@ -256,6 +257,10 @@
     if (!isOpen())
       throw new ClosedChannelException();
     
+    if (target instanceof InetSocketAddress
+	&& ((InetSocketAddress) target).isUnresolved())
+      throw new IOException("Target address not resolved");
+
     byte[] buffer;
     int offset = 0;
     int len = src.remaining();

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