[kaffe] CVS kaffe (dalibor): Small fix for nio

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Thu Feb 26 10:17:02 2004


PatchSet 4465 
Date: 2004/02/26 18:02:47
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Small fix for nio

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

        * libraries/javalib/gnu/java/nio/DatagramChannelImpl.java:
        Fixed problem with channels.DGKaboom example from Java NIO book.

Members: 
	ChangeLog:1.2045->1.2046 
	libraries/javalib/gnu/java/nio/DatagramChannelImpl.java:1.7->1.8 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2045 kaffe/ChangeLog:1.2046
--- kaffe/ChangeLog:1.2045	Thu Feb 26 17:08:08 2004
+++ kaffe/ChangeLog	Thu Feb 26 18:02:47 2004
@@ -1,3 +1,8 @@
+2004-02-26  Michael Koch  <konqueror@gmx.de>
+
+	* libraries/javalib/gnu/java/nio/DatagramChannelImpl.java:
+	Fixed problem with channels.DGKaboom example from Java NIO book.
+
 2004-02-26  Guilhem Lavaux <guilhem@kaffe.org>
 
 	* java/io/ObjectInputStream.java
Index: kaffe/libraries/javalib/gnu/java/nio/DatagramChannelImpl.java
diff -u kaffe/libraries/javalib/gnu/java/nio/DatagramChannelImpl.java:1.7 kaffe/libraries/javalib/gnu/java/nio/DatagramChannelImpl.java:1.8
--- kaffe/libraries/javalib/gnu/java/nio/DatagramChannelImpl.java:1.7	Mon Feb 23 20:12:39 2004
+++ kaffe/libraries/javalib/gnu/java/nio/DatagramChannelImpl.java	Thu Feb 26 18:02:48 2004
@@ -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();