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] java.nio - Exception throwing


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


This patch fixes some method deklarations in java.nio to trhow the 
correct exceptions. Please review and comment.

Michael
- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD4DBQE+Q4qRWSOgCCdjSDsRAuikAKCGe0/JS6qP+xOip63NaG3N6hj4mACVE5h2
yO0cONQFkTIcHinThgk97g==
=+ONh
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1663
diff -u -r1.1663 ChangeLog
--- ChangeLog	4 Feb 2003 21:07:15 -0000	1.1663
+++ ChangeLog	7 Feb 2003 10:21:32 -0000
@@ -1,3 +1,38 @@
+2003-02-07  Michael Koch  <konqueror@gmx.de>
+
+	* java/nio/channels/DatagramChannel.java
+	(write): Throws IOException.
+	(connect): Throws IOException.
+	(disconnect): Throws IOException.
+	(read): Throws IOException.
+	(receive): Throws IOException.
+	(send): Throws IOException.
+	* java/nio/channels/Pipe.java
+	(open): Throws IOException.
+	* java/nio/channels/SelectableChannel.java
+	(configureBlocking): Throws IOException.
+	* java/nio/channels/ServerSocketChannel.java
+	(accept): Throws IOException.
+	* java/nio/channels/SocketChannel.java
+	(SocketChannel): Implements ByteChannel, ScatteringByteChannel,
+	GatheringByteChannel.
+	(read): Throws IOException.
+	(write): Throws IOException.
+	(finishConnect): Throws IOException.
+	* java/nio/channels/spi/AbstractInterruptibleChannel.java
+	(end): Throws AsynchronousCloseException.
+	* java/nio/channels/spi/AbstractSelectableChannel.java
+	(configureBlocking): Throws IOException.
+	(implCloseChannel): Throws IOException.
+	(implCloseSelectableChannel): Throws IOException.
+	(implConfigureBlocking): Throws IOException.
+	* java/nio/channels/spi/SelectorProvider.java
+	(openDatagramChannel): Throws IOException.
+	(openPipe): Throws IOException.
+	(openSelector): Throws IOException.
+	(openServerSocketChannel): Throws IOException.
+	(openSocketChannel): Throws IOException.
+
 2003-02-04  Tom Tromey  <tromey@redhat.com>
 
 	* java/io/PipedOutputStream.java (flush): Declare as throwing
Index: java/nio/channels/DatagramChannel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/DatagramChannel.java,v
retrieving revision 1.5
diff -u -r1.5 DatagramChannel.java
--- java/nio/channels/DatagramChannel.java	29 Nov 2002 12:32:17 -0000	1.5
+++ java/nio/channels/DatagramChannel.java	7 Feb 2003 10:21:32 -0000
@@ -88,7 +88,7 @@
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException The channel's socket is not connected.
    */
-  public final long write (ByteBuffer[] srcs)
+  public final long write (ByteBuffer[] srcs) throws IOException
   {
     long b = 0;
     
@@ -111,14 +111,15 @@
    * @exception SecurityException If a security manager has been installed and
    * it does not permit datagrams to be sent to the given address.
    */
-  public abstract DatagramChannel connect (SocketAddress remote);
+  public abstract DatagramChannel connect (SocketAddress remote)
+    throws IOException;
 
   /**
    * Disonnects this channel's socket.
    *
    * @exception IOException If an error occurs
    */
-  public abstract DatagramChannel disconnect ();
+  public abstract DatagramChannel disconnect () throws IOException;
 
   /**
    * Tells whether or not this channel's socket is connected.
@@ -131,7 +132,7 @@
   /**
    * Reads data from this channel.
    */
-  public abstract int read (ByteBuffer dst);
+  public abstract int read (ByteBuffer dst) throws IOException;
   
   /**
    * Reads data from this channel.
@@ -139,7 +140,8 @@
    * @exception IOException If an error occurs.
    * @exception NotYetConnectedException The channel's socket is not connected.
    */
-  public abstract long read (ByteBuffer[] dsts, int offset, int length);
+  public abstract long read (ByteBuffer[] dsts, int offset, int length)
+    throws IOException;
  
   /**
    * Receives a datagram via this channel.
@@ -154,7 +156,7 @@
    * @exception SecurityException If a security manager has been installed and
    * it does not permit datagrams to be sent to the given address.
    */
-  public abstract SocketAddress receive (ByteBuffer dst);
+  public abstract SocketAddress receive (ByteBuffer dst) throws IOException;
  
   /**
    * Sends a datagram via this channel.
@@ -169,7 +171,8 @@
    * @exception SecurityException If a security manager has been installed and
    * it does not permit datagrams to be sent to the given address.
    */
-  public abstract int send (ByteBuffer src, SocketAddress target);
+  public abstract int send (ByteBuffer src, SocketAddress target)
+    throws IOException;
  
   /**
    * Retrieves the channel's socket.
@@ -182,7 +185,7 @@
    * @exception IOException If an error occurs.
    * @exception NotYetConnectedException The channel's socket is not connected.
    */
-  public abstract int write (ByteBuffer src);
+  public abstract int write (ByteBuffer src) throws IOException;
   
   /**
    * Writes data to this channel.
@@ -190,7 +193,8 @@
    * @exception IOException If an error occurs.
    * @exception NotYetConnectedException The channel's socket is not connected.
    */
-  public abstract long write (ByteBuffer[] srcs, int offset, int length);
+  public abstract long write (ByteBuffer[] srcs, int offset, int length)
+    throws IOException;
 
   /**
    * Retrieves the valid operations for this channel.
Index: java/nio/channels/Pipe.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/Pipe.java,v
retrieving revision 1.2
diff -u -r1.2 Pipe.java
--- java/nio/channels/Pipe.java	13 Nov 2002 13:52:47 -0000	1.2
+++ java/nio/channels/Pipe.java	7 Feb 2003 10:21:32 -0000
@@ -37,6 +37,7 @@
 
 package java.nio.channels;
 
+import java.io.IOException;
 import java.nio.channels.spi.AbstractSelectableChannel;
 import java.nio.channels.spi.SelectorProvider;
 
@@ -104,7 +105,7 @@
    * 
    * @exception IOException If an error occurs
    */
-  public static Pipe open()
+  public static Pipe open() throws IOException
   {
     return SelectorProvider.provider ().openPipe();
   }
Index: java/nio/channels/SelectableChannel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/SelectableChannel.java,v
retrieving revision 1.2
diff -u -r1.2 SelectableChannel.java
--- java/nio/channels/SelectableChannel.java	13 Nov 2002 13:52:47 -0000	1.2
+++ java/nio/channels/SelectableChannel.java	7 Feb 2003 10:21:32 -0000
@@ -37,6 +37,7 @@
 
 package java.nio.channels;
 
+import java.io.IOException;
 import java.nio.channels.spi.AbstractInterruptibleChannel;
 import java.nio.channels.spi.SelectorProvider;
 
@@ -67,7 +68,8 @@
    * is registered with one or more selectors.
    * @exception IOException If an error occurs.
    */
-  public abstract SelectableChannel configureBlocking (boolean block);
+  public abstract SelectableChannel configureBlocking (boolean block)
+    throws IOException;
   
   /**
    * Tells whether this channel is blocking or not.
Index: java/nio/channels/ServerSocketChannel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/ServerSocketChannel.java,v
retrieving revision 1.5
diff -u -r1.5 ServerSocketChannel.java
--- java/nio/channels/ServerSocketChannel.java	20 Nov 2002 16:19:08 -0000	1.5
+++ java/nio/channels/ServerSocketChannel.java	7 Feb 2003 10:21:32 -0000
@@ -73,7 +73,7 @@
    * @exception SecurityException If a security manager has been installed and
    * it does not permit access to the remote endpoint of the new connection.
    */
-  public abstract SocketChannel accept ();
+  public abstract SocketChannel accept () throws IOException;
   
   /**
    * Retrieves the channels socket.
Index: java/nio/channels/SocketChannel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/SocketChannel.java,v
retrieving revision 1.5
diff -u -r1.5 SocketChannel.java
--- java/nio/channels/SocketChannel.java	29 Nov 2002 12:32:17 -0000	1.5
+++ java/nio/channels/SocketChannel.java	7 Feb 2003 10:21:32 -0000
@@ -49,6 +49,7 @@
  * @since 1.4
  */
 abstract public class SocketChannel extends AbstractSelectableChannel
+  implements ByteChannel, ScatteringByteChannel, GatheringByteChannel
 {
   /**
    * Initializes this socket.
@@ -100,7 +101,7 @@
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
-  public final long read (ByteBuffer[] dsts)
+  public final long read (ByteBuffer[] dsts) throws IOException
   {
     long b = 0;
     
@@ -118,7 +119,7 @@
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
-  public final long write (ByteBuffer[] dsts)
+  public final long write (ByteBuffer[] dsts) throws IOException
   {
     long b = 0;
 
@@ -144,7 +145,7 @@
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
-  public abstract int read (ByteBuffer dst);
+  public abstract int read (ByteBuffer dst) throws IOException;
 
   /**
    * Connects the channel's socket to the remote address.
@@ -179,7 +180,7 @@
    * @exception NoConnectionPendingException If this channel is not connected
    * and a connection operation has not been initiated.
    */
-  public abstract boolean finishConnect ();
+  public abstract boolean finishConnect () throws IOException;
  
   /**
    * Tells whether or not the channel's socket is connected.
@@ -197,7 +198,8 @@
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
-  public abstract long read (ByteBuffer[] dsts, int offset, int length);
+  public abstract long read (ByteBuffer[] dsts, int offset, int length)
+    throws IOException;
  
   /**
    * Retrieves the channel's socket.
@@ -210,7 +212,7 @@
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
-  public abstract int write (ByteBuffer src);
+  public abstract int write (ByteBuffer src) throws IOException;
   
   /**
    * Writes data to the channel.
@@ -218,5 +220,6 @@
    * @exception IOException If an error occurs
    * @exception NotYetConnectedException If this channel is not yet connected.
    */
-  public abstract long write (ByteBuffer[] srcs, int offset, int length);
+  public abstract long write (ByteBuffer[] srcs, int offset, int length)
+    throws IOException;
 }
Index: java/nio/channels/spi/AbstractInterruptibleChannel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java,v
retrieving revision 1.2
diff -u -r1.2 AbstractInterruptibleChannel.java
--- java/nio/channels/spi/AbstractInterruptibleChannel.java	13 Nov 2002 13:52:47 -0000	1.2
+++ java/nio/channels/spi/AbstractInterruptibleChannel.java	7 Feb 2003 10:21:32 -0000
@@ -38,6 +38,7 @@
 package java.nio.channels.spi;
 
 import java.io.IOException;
+import java.nio.channels.AsynchronousCloseException;
 import java.nio.channels.Channel;
 import java.nio.channels.InterruptibleChannel;
 
@@ -84,6 +85,7 @@
    * I/O operation was interrupted.
    */
   protected final void end (boolean completed)
+    throws AsynchronousCloseException
   {
   }   
 
Index: java/nio/channels/spi/AbstractSelectableChannel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/spi/AbstractSelectableChannel.java,v
retrieving revision 1.4
diff -u -r1.4 AbstractSelectableChannel.java
--- java/nio/channels/spi/AbstractSelectableChannel.java	20 Nov 2002 16:19:08 -0000	1.4
+++ java/nio/channels/spi/AbstractSelectableChannel.java	7 Feb 2003 10:21:32 -0000
@@ -75,6 +75,7 @@
    * Adjusts this channel's blocking mode.
    */
   public final SelectableChannel configureBlocking (boolean block)
+    throws IOException
   {
     synchronized (LOCK)
       {
@@ -90,7 +91,7 @@
    *
    * @exception IOException If an error occurs
    */
-  protected final void implCloseChannel ()
+  protected final void implCloseChannel () throws IOException
   {
     implCloseSelectableChannel ();
   }
@@ -98,12 +99,13 @@
   /**
    * Closes this selectable channel.
    */
-  protected abstract void implCloseSelectableChannel ();
+  protected abstract void implCloseSelectableChannel () throws IOException;
   
   /**
    * Adjusts this channel's blocking mode.
    */
-  protected abstract void implConfigureBlocking (boolean block);
+  protected abstract void implConfigureBlocking (boolean block)
+    throws IOException;
 
   /**
    * Tells whether or not every I/O operation on this channel will block
Index: java/nio/channels/spi/SelectorProvider.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/channels/spi/SelectorProvider.java,v
retrieving revision 1.2
diff -u -r1.2 SelectorProvider.java
--- java/nio/channels/spi/SelectorProvider.java	13 Nov 2002 13:52:47 -0000	1.2
+++ java/nio/channels/spi/SelectorProvider.java	7 Feb 2003 10:21:32 -0000
@@ -38,6 +38,7 @@
 package java.nio.channels.spi;
 
 /* import gnu.java.nio.channels.SelectorProviderImpl; */
+import java.io.IOException;
 import java.nio.channels.DatagramChannel;
 import java.nio.channels.Pipe;
 import java.nio.channels.ServerSocketChannel;
@@ -67,27 +68,28 @@
   /**
    * Opens a datagram channel.
    */
-  public abstract DatagramChannel openDatagramChannel ();
+  public abstract DatagramChannel openDatagramChannel () throws IOException;
   
   /**
    * Opens a pipe.
    */
-  public abstract Pipe openPipe ();
+  public abstract Pipe openPipe () throws IOException;
   
   /**
    * Opens a selector.
    */
-  public abstract AbstractSelector openSelector ();
+  public abstract AbstractSelector openSelector () throws IOException;
   
   /**
    * Opens a server socket channel.
    */
-  public abstract ServerSocketChannel openServerSocketChannel ();
+  public abstract ServerSocketChannel openServerSocketChannel ()
+    throws IOException;
   
   /**
    * Opens a socket channel.
    */
-  public abstract SocketChannel openSocketChannel ();
+  public abstract SocketChannel openSocketChannel () throws IOException;
     
   /**
    * Returns the system-wide default selector provider for this invocation

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