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]

And again more java.net stuff


Hello list,


I have made anothe patch for java.net. That not quite correct. This 
patch even bugfixes two files in javax/naming. ;-)

Please review, comment, or what else is neede to get it into cvs.

Adam: This patch does not change any things that can break on cygwin.


Michael
-- 
Homepage: http://www.worldforge.org/
GPG-key: http://konqueror.dyndns.org/~mkoch/michael.gpg
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1448
diff -u -b -r1.1448 ChangeLog
--- ChangeLog	23 Sep 2002 17:56:33 -0000	1.1448
+++ ChangeLog	24 Sep 2002 13:32:15 -0000
@@ -1,3 +1,85 @@
+2002-09-24  Michael Koch  <konqueror@gmx.de>
+
+	* java/net/DatagramPacket
+	(DatagramPacket): Exception documentation added.
+	(setData): Likewise.
+	(setSocketAddress): Likewise.
+	* java/net/DatagramSocketImpl.java
+	(peek): Documentation addded.
+	(peekData): Documentation addded.
+	(send): Documentation addded.
+	(receive): Documentation addded.
+	(connect): New method.
+	(disconnect): New method.
+	(joinGroup): New abstract method.
+	(leaveGroup): New abstract method.
+	* java/net/InetSocketAddress.java
+	(InetSocketAddress): Documentation added.
+	(equals): final keyword added.
+	(getAddress): final keyword added.
+	(getHostName): final keyword added.
+	(getPort): final keyword added.
+	(hashCode): final keyword added.
+	(isUnresolved): final keyword added.
+	* java/net/MulticastSocket.java
+	(MulticastSocket): Documentation added.
+	(MulticastSocket): New method.
+	(joinGroup): Documentation added.
+	(joinGroup): New method.
+	(leaveGroup): Documentation added.
+	(leaveGroup): New method.
+	(send): Documentation added.
+	* java/net/NetworkInterface.java
+	(getByName): Documentation added.
+	(getByInetAddress): Documentation added.
+	(getNetworkInterfaces): Documentation added.
+	* java/net/PlainDatagramSocketImpl.java
+	(connect): New method.
+	(disconnect): New method.
+	* java/net/SocketImpl.java
+	(create): Documentation added.
+	(shutdownInput): Convert public to protected, as it always was.
+	(shutdownOutput): Convert public to protected, as it always was.
+	* java/net/SocketOptions.java
+	(whole file): Reintented.
+	* java/net/URLClassLoader.java
+	(URLClassLoader): SecurityManager check added, documentation added.
+	(findResources): Documentation added.
+	(findClass): Documentation added.
+	(newInstance): More correct method arguments.
+	* java/net/URLConnection.java
+	(connect): Documentation added.
+	(getContent): Documentation added.
+	(getPermission): Documentation added.
+	(getInputStream): Documentation added.
+	(getOutputStream): Documentation added.
+	(setDoInput): Throw correct exception, documentation added.
+	(setDoOutput): Throw correct exception, documentation added.
+	(setAllowUserInteraction): Throw correct exception, documentation added.
+	(setUseCaches): Throw correct exception, documentation added.
+	(setIfModifiedSince): Throw correct exception, documentation added.
+	(setRequestProperty): Throw exception, documentation added.
+	(addRequestProperty): Throw exception, documentation added.
+	(getRequestProperty): Throw exception, documentation added.
+	(getRequestProperties): Documentation added.
+	(setContentHandlerFactory): Documentation added.
+	(guessContentTypeFromName): protected to public.
+	(setFileNameMap): Documentation added.
+	* java/net/URLDecoder.java
+	(URLDecoder): New method.
+	(decode): Documentation added.
+	(whole file): Reindented.
+	* java/net/URLEncoder.java
+	(encode): Documentation added.
+	* java/net/natPlainDatagramSocketImpl.cc
+	(connect): New method.
+	(disconnect): New method.
+	* javax/naming/RefAddr:
+	(addrType): addrType was never final.
+	(equals): Fix typo in method name.
+	* javax/naming/BinaryRefAddr:
+	(equals): Fix typo in method name.
+
 2002-09-22  Tom Tromey  <tromey@redhat.com>
 
 	Fix for PR libgcj/6576:
Index: java/net/DatagramPacket.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/DatagramPacket.java,v
retrieving revision 1.10
diff -u -b -r1.10 DatagramPacket.java
--- java/net/DatagramPacket.java	13 Sep 2002 11:39:47 -0000	1.10
+++ java/net/DatagramPacket.java	24 Sep 2002 13:32:16 -0000
@@ -195,6 +195,7 @@
    * @param address The socket address to send to
    *
    * @exception SocketException If an error occurs
+   * @exception IllegalArgumentException If address type is not supported
    *
    * @since 1.4
    */
@@ -215,6 +216,7 @@
    * @param address The socket address to send to
    *
    * @exception SocketException If an error occurs
+   * @exception IllegalArgumentException If address type is not supported
    *
    * @since 1.4
    */
@@ -321,7 +323,7 @@
    *
    * @param address The socket address of the remove host
    *
-   * @exception IllegalArgumentException If an error occurs
+   * @exception IllegalArgumentException If address type is not supported
    *
    * @since 1.4
    */
@@ -353,6 +355,8 @@
    *
    * @param buf The new buffer for this packet
    *
+   * @exception NullPointerException If the argument is null
+   *
    * @since 1.1
    */
   public synchronized void setData(byte[] buf)
@@ -372,6 +376,8 @@
    * @param offset The offset into the buffer to start reading data from.
    * @param length The number of bytes of data in the buffer.
    *
+   * @exception NullPointerException If the argument is null
+   *
    * @since 1.2
    */
   public synchronized void setData(byte[] buf, int offset, int length)
@@ -397,6 +403,9 @@
    * Sets the length of the data in the buffer. 
    *
    * @param length The new length.  (Where len <= buf.length)
+   *
+   * @exception IllegalArgumentException f the length is negative or
+   * if the length is greater than the packet's data buffer length
    *
    * @since 1.1
    */
Index: java/net/DatagramSocketImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/DatagramSocketImpl.java,v
retrieving revision 1.11
diff -u -b -r1.11 DatagramSocketImpl.java
--- java/net/DatagramSocketImpl.java	12 Sep 2002 06:35:50 -0000	1.11
+++ java/net/DatagramSocketImpl.java	24 Sep 2002 13:32:16 -0000
@@ -108,6 +108,9 @@
    * @return The port number of the sender of the packet
    *
    * @exception IOException If an error occurs
+   * @exception PortUnreachableException May be thrown if the socket is
+   * connected to a currently unreachable destination. Note, there is no
+   * guarantee that the exception will be thrown.
    */
   protected abstract int peek(InetAddress i) throws IOException;
 
@@ -120,6 +123,9 @@
    * @return The port number of the sender of the packet.
    * 
    * @exception IOException If an error occurs
+   * @exception PortUnreachableException May be thrown if the socket is
+   * connected to a currently unreachable destination. Note, there is no
+   * guarantee that the exception will be thrown.
    * 
    * @since 1.4
    */
@@ -132,6 +138,9 @@
    * @param p The packet to send
    *
    * @exception IOException If an error occurs
+   * @exception PortUnreachableException May be thrown if the socket is
+   * connected to a currently unreachable destination. Note, there is no
+   * guarantee that the exception will be thrown.
    */
   protected abstract void send(DatagramPacket p) throws IOException;
 
@@ -143,10 +152,38 @@
    * @param p A place to store the incoming packet.
    *
    * @exception IOException If an error occurs
+   * @exception PortUnreachableException May be thrown if the socket is
+   * connected to a currently unreachable destination. Note, there is no
+   * guarantee that the exception will be thrown.
    */
   protected abstract void receive(DatagramPacket p) throws IOException;
 
   /**
+   * Connects the socket to a host specified by address and port.
+   *
+   * @param address The InetAddress of the host to connect to
+   * @param port The port number of the host to connect to
+   *
+   * @exception SocketException If an error occurs
+   *
+   * @since 1.4
+   */
+  protected void connect (InetAddress address, int port) throws SocketException
+  {
+    // This method has to be overwritten by real implmentations
+  }
+
+  /**
+   * Disconnects the socket.
+   * 
+   * @since 1.4
+   */
+  protected void disconnect ()
+  {
+    // This method has to be overwritten by real implmentations
+  }
+
+  /**
    * Sets the Time to Live (TTL) setting on this socket to the specified
    * value. <b>Use <code>setTimeToLive(int)</code></b> instead.
    *
@@ -202,6 +239,35 @@
    */
   protected abstract void leave(InetAddress inetaddr) throws IOException;
 
+  /**
+   * Causes this socket to join the specified multicast group on a specified
+   * device 
+   * 
+   * @param mcastaddr The address to leave
+   * @param netIf The specified network interface to join the group at
+   *
+   * @exception IOException If an error occurs
+   * 
+   * @since 1.4
+   */
+  protected abstract void joinGroup (SocketAddress mcastaddr,
+		                     NetworkInterface netIf)
+    throws IOException;
+
+  /**
+   * Leaves a multicast group
+   * 
+   * @param mcastaddr The address to join
+   * @param netIf The specified network interface to leave the group at
+   *
+   * @exception IOException If an error occurs
+   * 
+   * @since 1.4
+   */
+  protected abstract void leaveGroup (SocketAddress mcastaddr,
+		                      NetworkInterface netIf)
+    throws IOException;
+  
   /**
    * Returns the FileDescriptor for this socket
    */
Index: java/net/InetSocketAddress.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/InetSocketAddress.java,v
retrieving revision 1.3
diff -u -b -r1.3 InetSocketAddress.java
--- java/net/InetSocketAddress.java	28 Aug 2002 19:23:50 -0000	1.3
+++ java/net/InetSocketAddress.java	24 Sep 2002 13:32:16 -0000
@@ -73,7 +73,7 @@
      * 
      * @param port Port if the socket
      *
-     * @exception IllegalArgumentException If the port number is illegel
+     * @exception IllegalArgumentException If the port number is illegal
      */
     public InetSocketAddress(int port)
 	throws IllegalArgumentException
@@ -94,6 +94,8 @@
      * 
      * @param addr Address of the socket
      * @param port Port if the socket
+     *
+     * @exception IllegalArgumentException If the port number is illegal
      */
     public InetSocketAddress(String hostname, int port)
 	throws IllegalArgumentException
@@ -112,7 +114,7 @@
      * Test if obj is a InetSocketAddress and
      * has the same address & port
      */
-    public boolean equals(Object obj)
+    public final boolean equals(Object obj)
     {
 	if (obj instanceof InetSocketAddress)
 	    {
@@ -122,17 +124,17 @@
 	return false;
     }
 
-    public InetAddress getAddress()
+    public final InetAddress getAddress()
     {
 	return addr;
     }
 
-    public String getHostName()
+    public final String getHostName()
     {
 	return addr.getHostName();
     }
 
-    public int getPort()
+    public final int getPort()
     {
 	return port;
     }
@@ -140,7 +142,7 @@
     /**
      * TODO: see what sun does here.
      */
-    public int hashCode()
+    public final int hashCode()
     {
 	return port + addr.hashCode();
     }
@@ -148,7 +150,7 @@
     /**
      * TODO: see what sun does here.
      */
-    public boolean isUnresolved()
+    public final boolean isUnresolved()
     {
 	return addr == null;
     }
Index: java/net/MulticastSocket.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/MulticastSocket.java,v
retrieving revision 1.13
diff -u -b -r1.13 MulticastSocket.java
--- java/net/MulticastSocket.java	4 Sep 2002 17:35:22 -0000	1.13
+++ java/net/MulticastSocket.java	24 Sep 2002 13:32:16 -0000
@@ -73,6 +73,8 @@
    * Create a MulticastSocket that this not bound to any address
    *
    * @exception IOException If an error occurs
+   * @exception SecurityException If a security manager exists and its
+   * checkListen method doesn't allow the operation
    */
   public MulticastSocket() throws IOException
   {
@@ -85,6 +87,8 @@
    * @param port The port to bind to
    *
    * @exception IOException If an error occurs
+   * @exception SecurityException If a security manager exists and its
+   * checkListen method doesn't allow the operation
    */
   public MulticastSocket(int port) throws IOException
   {
@@ -92,6 +96,22 @@
   }
 
   /**
+   * Create a multicast socket bound to the specified SocketAddress.
+   *
+   * @param address The SocketAddress the multicast socket will be bound to
+   *
+   * @exception IOException If an error occurs
+   * @exception SecurityException If a security manager exists and its
+   * checkListen method doesn't allow the operation
+   *
+   * @since 1.4
+   */
+  public MulticastSocket(SocketAddress address) throws IOException
+  {
+    super(address);
+  }
+  
+  /**
    * Returns the interface being used for multicast packets
    * 
    * @return The multicast interface
@@ -232,6 +252,7 @@
    * @param addr The address of the group to join
    * 
    * @exception IOException If an error occurs
+   * @exception SecurityException FIXME
    */
   public void joinGroup(InetAddress mcastaddr) throws IOException
   {
@@ -251,6 +272,7 @@
    * @param addr The address of the group to leave
    *
    * @exception IOException If an error occurs
+   * @exception SecurityException FIXME
    */
   public void leaveGroup(InetAddress mcastaddr) throws IOException
   {
@@ -265,6 +287,74 @@
   }
 
   /**
+   * Joins the specified mulitcast group on a specified interface.
+   *
+   * @param mcastaddr The multicast address to join
+   * @param netIf The local network interface to receive the multicast
+   * messages on or null to defer the interface set by #setInterface or
+   * #setNetworkInterface
+   * 
+   * @exception IOException If an error occurs
+   * @exception IllegalArgumentException If address type is not supported
+   * @exception SecurityException FIXME
+   *
+   * @see MulticastSocket:setInterface
+   * @see MulticastSocket:setNetworkInterface
+   *
+   * @since 1.4
+   */
+  public void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
+    throws IOException
+  {
+    if (! (mcastaddr instanceof InetSocketAddress))
+      throw new IllegalArgumentException ("SocketAddress type not supported");
+
+    InetSocketAddress tmp = (InetSocketAddress) mcastaddr;
+    
+    if (! tmp.getAddress ().isMulticastAddress ())
+      throw new IOException ("Not a Multicast address");
+
+    // FIXME: check if this check is sufficient. Do we need to check the port ?
+    SecurityManager s = System.getSecurityManager ();
+    if (s != null)
+      s.checkMulticast (tmp.getAddress ());
+
+    impl.joinGroup (mcastaddr, netIf);
+  }
+  
+  /**
+   * Leaves the specified mulitcast group on a specified interface.
+   *
+   * @param mcastaddr The multicast address to leave
+   * @param netIf The local networki interface or null to defer to the
+   * interface set by setInterface or setNetworkInterface 
+   *
+   * @exception IOException If an error occurs
+   * @exception IllegalArgumentException If address type is not supported
+   * @exception SecurityException FIXME
+   *
+   * @see MulticastSocket:setInterface
+   * @see MulticastSocket:setNetworkInterface
+   *
+   * @since 1.4
+   */
+  public void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
+    throws IOException
+  {
+    InetSocketAddress tmp = (InetSocketAddress) mcastaddr;
+    
+    if (! tmp.getAddress ().isMulticastAddress ())
+      throw new IOException ("Not a Multicast address");
+
+    // FIXME: do we need to check the port too, or is this sufficient ?
+    SecurityManager s = System.getSecurityManager ();
+    if (s != null)
+      s.checkMulticast (tmp.getAddress ());
+
+    impl.leaveGroup (mcastaddr, netIf);
+  }
+  
+  /**
    * Sends a packet of data to a multicast address with a TTL that is
    * different from the default TTL on this socket.  The default TTL for
    * the socket is not changed.
@@ -273,6 +363,7 @@
    * @param ttl The TTL for this packet
    *
    * @exception IOException If an error occurs
+   * @exception SecurityException FIXME
    */
   public synchronized void send(DatagramPacket p, byte ttl) throws IOException
   {
Index: java/net/NetworkInterface.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/NetworkInterface.java,v
retrieving revision 1.1
diff -u -b -r1.1 NetworkInterface.java
--- java/net/NetworkInterface.java	17 Sep 2002 06:58:40 -0000	1.1
+++ java/net/NetworkInterface.java	24 Sep 2002 13:32:16 -0000
@@ -118,6 +118,9 @@
    *  Returns an network interface by name
    *
    *  @param name The name of the interface to return
+   *
+   *  @exception SocketException If an error occurs
+   *  @exception NullPointerException If the specified name is null
    */
   public static NetworkInterface getByName (String name)
     throws SocketException
@@ -141,6 +144,9 @@
    *  Return a network interface by its address
    *
    *  @param addr The address of the interface to return
+   *
+   *  @exception SocketException If an error occurs
+   *  @exception NullPointerException If the specified addess is null
    */
   public static NetworkInterface getByInetAddress (InetAddress addr)
     throws SocketException
@@ -167,6 +173,8 @@
 
   /**
    *  Return an Enumeration of all available network interfaces
+   *
+   *  @exception SocketException If an error occurs
    */
   public static Enumeration getNetworkInterfaces ()
     throws SocketException
Index: java/net/PlainDatagramSocketImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/PlainDatagramSocketImpl.java,v
retrieving revision 1.14
diff -u -b -r1.14 PlainDatagramSocketImpl.java
--- java/net/PlainDatagramSocketImpl.java	21 Sep 2002 06:59:20 -0000	1.14
+++ java/net/PlainDatagramSocketImpl.java	24 Sep 2002 13:32:16 -0000
@@ -63,6 +63,9 @@
 
   protected native void bind(int lport, InetAddress laddr)
 	throws SocketException;
+  protected native void connect (InetAddress i, int port)
+	throws SocketException;
+  protected native void disconnect ();
   protected native void create() throws SocketException;
   protected native int peek(InetAddress i) throws IOException;
   protected native int peekData (DatagramPacket dp) throws IOException;
Index: java/net/SocketImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/SocketImpl.java,v
retrieving revision 1.10
diff -u -b -r1.10 SocketImpl.java
--- java/net/SocketImpl.java	10 Sep 2002 18:02:02 -0000	1.10
+++ java/net/SocketImpl.java	24 Sep 2002 13:32:16 -0000
@@ -95,6 +95,8 @@
    * if the stream parameter is false.
    *
    * @param stream true for a stream socket, false for a datagram socket
+   *
+   * @exception IOException If an error occurs
    */
   protected abstract void create(boolean stream) throws IOException;
 
@@ -311,7 +313,7 @@
    *
    * @exception IOException if an error occurs
    */
-  public abstract void shutdownInput () throws IOException;
+  protected abstract void shutdownInput () throws IOException;
 
   /**
    * Shut down the output side of this socket.  Subsequent writes will
@@ -319,5 +321,5 @@
    *
    * @exception IOException if an error occurs
    */
-  public abstract void shutdownOutput () throws IOException;
+  protected abstract void shutdownOutput () throws IOException;
 }
Index: java/net/SocketOptions.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/SocketOptions.java,v
retrieving revision 1.8
diff -u -b -r1.8 SocketOptions.java
--- java/net/SocketOptions.java	4 Sep 2002 05:34:12 -0000	1.8
+++ java/net/SocketOptions.java	24 Sep 2002 13:32:16 -0000
@@ -55,99 +55,86 @@
   */
 public interface SocketOptions
 {
-
-/*************************************************************************/
-
-/*
- * Static Variables
- */
-
-/**
+  /**
  * Option id for the SO_KEEPALIVE value
  * @since 1.3
  */
-static final int SO_KEEPALIVE = 0x8;
+  static final int SO_KEEPALIVE = 0x8;
 	
-/**
+  /**
   * Option id for the SO_LINGER value
   */
-static final int SO_LINGER = 0x80; // 128
+  static final int SO_LINGER = 0x80; // 128
 
-/**
+  /**
   * Option id for the SO_TIMEOUT value
   */
-static final int SO_TIMEOUT = 0x1006; // 4102
+  static final int SO_TIMEOUT = 0x1006; // 4102
 
-/**
+  /**
   * Retrieve the local address to which the socket is bound.
   */
-static final int SO_BINDADDR = 0x0F; // 15
+  static final int SO_BINDADDR = 0x0F; // 15
 
-/**
+  /**
   * Option id for the send buffer size
   * @since 1.2
   */
-static final int SO_SNDBUF = 0x1001; // 4097
+  static final int SO_SNDBUF = 0x1001; // 4097
 
-/**
+  /**
   * Option id for the receive buffer size
   * @since 1.2
   */
-static final int SO_RCVBUF = 0x1002; // 4098
+  static final int SO_RCVBUF = 0x1002; // 4098
 
-/**
+  /**
   * Sets the SO_REUSEADDR parameter on a socket
   */
-static final int SO_REUSEADDR = 0x04; // 4
+  static final int SO_REUSEADDR = 0x04; // 4
 
-/**
+  /**
  * Sets SO_BROADCAST for a socket
  * @since 1.4
  */
-static final int SO_BROADCAST = 0x20; // 32
+  static final int SO_BROADCAST = 0x20; // 32
 
-/**
+  /**
  * Sets SO_OOBINLINE for a socket
  * @since 1.4
  */
-static final int SO_OOBINLINE = 0x1003; // 4099
+  static final int SO_OOBINLINE = 0x1003; // 4099
 
-/**
+  /**
   * Option id for the TCP_NODELAY value
   */
-static final int TCP_NODELAY = 0x01; // 1
+  static final int TCP_NODELAY = 0x01; // 1
 
-/**
+  /**
   * Options id for the IP_MULTICAST_IF value
   */
-static final int IP_MULTICAST_IF = 0x10; // 16
+  static final int IP_MULTICAST_IF = 0x10; // 16
 
-/**
+  /**
  * same as above
  * @since 1.4
  */
-static final int IP_MULTICAST_IF2 = 0x1F; // 31
+  static final int IP_MULTICAST_IF2 = 0x1F; // 31
 
-/**
+  /**
  * This option enables or disables local loopback of multicast datagrams.
  * @since 1.4
  */
-static final int IP_MULTICAST_LOOP = 0x12; // 18
+  static final int IP_MULTICAST_LOOP = 0x12; // 18
 
-/**
+  /**
  * This option sets the type-of-service or traffic class field in the
  * IP header for a TCP or UDP socket.
  * @since 1.4
  */
-static final int IP_TOS = 0x03; // 3
+  static final int IP_TOS = 0x03; // 3
 
-/*************************************************************************/
-
-/*
- * Interface Methods
- */
-
-/**
+  /**
   * Sets the specified option on a socket to the passed in object.  For
   * options that take an integer argument, the passed in object is an
   * <code>Integer</code>.  For options that are set to on or off, the
@@ -159,12 +146,9 @@
   *
   * @exception SocketException If an error occurs
   */
-void
-setOption(int option_id, Object val) throws SocketException;
-
-/*************************************************************************/
+  void setOption(int option_id, Object val) throws SocketException;
 
-/**
+  /**
   * Returns the current setting of the specified option.  The 
   * <code>Object</code> returned will be an <code>Integer</code> for options 
   * that have integer values.  For options that are set to on or off, a 
@@ -177,8 +161,7 @@
   *
   * @exception SocketException If an error occurs
   */
-Object
-getOption(int option_id) throws SocketException;
+  Object getOption(int option_id) throws SocketException;
 
 } // interface SocketOptions
 
Index: java/net/URLClassLoader.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URLClassLoader.java,v
retrieving revision 1.9
diff -u -b -r1.9 URLClassLoader.java
--- java/net/URLClassLoader.java	16 Sep 2002 21:40:40 -0000	1.9
+++ java/net/URLClassLoader.java	24 Sep 2002 13:32:16 -0000
@@ -40,11 +40,23 @@
       return null;
   }
 
+  /**
+   * Createa a new URL class loader object
+   *
+   * @exception SecurityException If a security manager exists and its
+   * checkCreateClassLoader method doesn't allow creation of a class loader
+   */
   public URLClassLoader (URL[] urls)
   { 
     this (urls, null, null);
   }
   
+  /**
+   * Createa a new URL class loader object
+   *
+   * @exception SecurityException If a security manager exists and its
+   * checkCreateClassLoader method doesn't allow creation of a class loader
+   */
   public URLClassLoader (URL[] urls, ClassLoader parent)
   { 
     this (urls, parent, null);
@@ -100,11 +112,21 @@
     info.addElement (conn);
   }
 
+  /**
+   * Createa a new URL class loader object
+   *
+   * @exception SecurityException If a security manager exists and its
+   * checkCreateClassLoader method doesn't allow creation of a class loader
+   */
   public URLClassLoader (URL[] urls, ClassLoader parent,
 			 URLStreamHandlerFactory fac)
   { 
     super (parent);
 
+    SecurityManager s = System.getSecurityManager();
+    if (s != null)
+      s.checkCreateClassLoader();
+
     factory = fac;
 
     if (urls == null || urls.length == 0)
@@ -151,6 +173,12 @@
     return urls;
   }
   
+  /**
+   * Returns an Enumeration of URLs representing all of the resources on the
+   * URL search path having the specified name
+   *
+   * @exception IOException If an error occurs
+   */
   public Enumeration findResources (String name)
   {
     Vector results = new Vector ();
@@ -224,7 +252,12 @@
     return null;
   }
 
-  // and finally, we can implement our class loader functionality.
+  /**
+   * Finds and loads the class with the specified name from the
+   * URL search path
+   *
+   * @exception ClassNotFoundException If the class could not be found
+   */
   protected Class findClass (String name)
     throws ClassNotFoundException
   {
@@ -404,7 +437,7 @@
    * system class loader.
    * @param urls the initial URLs used to resolve classes and resources
    */
-  public static URLClassLoader newInstance(URL urls[]) throws
+  public static URLClassLoader newInstance(URL[] urls) throws
     SecurityException
   {
     return new URLClassLoader(urls);
@@ -416,7 +449,7 @@
    * @param urls the initial URLs used to resolve classes and resources
    * @param parent the parent class loader
    */
-  public static URLClassLoader newInstance(URL urls[],
+  public static URLClassLoader newInstance(URL[] urls,
 					   ClassLoader parent)
     throws SecurityException
   {
Index: java/net/URLConnection.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URLConnection.java,v
retrieving revision 1.11
diff -u -b -r1.11 URLConnection.java
--- java/net/URLConnection.java	13 Sep 2002 11:39:47 -0000	1.11
+++ java/net/URLConnection.java	24 Sep 2002 13:32:17 -0000
@@ -72,6 +72,8 @@
   /**
    * Creates a real connection to the object references by the URL given
    * to the constructor
+   *
+   * @exception IOException If an error occurs
    */
   public abstract void connect() throws IOException;
 
@@ -229,6 +231,10 @@
 
   /**
    * Retrieves the content of this URLConnection
+   *
+   * @exception IOException If an error occurs
+   * @exception UnknownServiceException If the protocol does not support the
+   * content type
    */
   public Object getContent() throws IOException
   {
@@ -248,6 +254,9 @@
    * Returns a permission object representing the permission necessary to make
    * the connection represented by this object. This method returns null if no
    * permission is required to make the connection.
+   *
+   * @exception IOException If the computation of the permission requires
+   * network or file I/O and an exception occurs while computing it
    */
   public Permission getPermission() throws IOException
   {
@@ -257,6 +266,9 @@
 
   /**
    * Returns the input stream of the URL connection
+   *
+   * @exception IOException If an error occurs
+   * @exception UnknownServiceException If the protocol does not support input
    */
   public InputStream getInputStream() throws IOException
   {
@@ -267,6 +279,9 @@
 
   /**
    * Returns the output stream of the URL connection
+   *
+   * @exception IOException If an error occurs
+   * @exception UnknownServiceException If the protocol does not support output
    */
   public OutputStream getOutputStream() throws IOException
   {
@@ -287,11 +302,13 @@
    * Sets tha value of the doInput field.
    *
    * @param doinput The new value of the doInput field
+   *
+   * @exception IllegalStateException If already connected
    */
   public void setDoInput(boolean doinput)
   {
     if (connected)
-      throw new IllegalAccessError("Already connected");
+      throw new IllegalStateException ("Already connected");
 
     doInput = doinput;
   }
@@ -308,11 +325,13 @@
    * Sets the value of the doOutput field
    *
    * @param dooutput The new value of the doOutput field
+   *
+   * @exception IllegalStateException If already connected
    */
   public void setDoOutput(boolean dooutput)
   {
     if (connected)
-      throw new IllegalAccessError("Already connected");
+      throw new IllegalStateException ("Already connected");
 
     doOutput = dooutput;
   }
@@ -329,11 +348,13 @@
    * Sets a new value to the allowUserInteraction field
    *
    * @param allowed The new value
+   *
+   * @exception IllegalStateException If already connected
    */
   public void setAllowUserInteraction(boolean allowed)
   {
     if (connected)
-      throw new IllegalAccessError("Already connected");
+      throw new IllegalStateException ("Already connected");
 
     allowUserInteraction = allowed;
   }
@@ -368,11 +389,13 @@
    * Sets a new value to the useCaches field
    *
    * @param usecaches The new value
+   *
+   * @exception IllegalStateException If already connected
    */
   public void setUseCaches(boolean usecaches)
   {
     if (connected)
-      throw new IllegalAccessError("Already connected");
+      throw new IllegalStateException ("Already connected");
 
     useCaches = usecaches;
   }
@@ -390,11 +413,13 @@
    *
    * @param ifmodifiedsince The new value in milliseconds
    * since January 1, 1970 GMT
+   *
+   * @exception IllegalStateException If already connected
    */
   public void setIfModifiedSince(long ifmodifiedsince)
   {
     if (connected)
-      throw new IllegalAccessError("Already connected");
+      throw new IllegalStateException ("Already connected");
 
     ifModifiedSince = ifmodifiedsince;
   }
@@ -431,11 +456,17 @@
    * @param key Key of the property to set
    * @param value Value of the Property to set
    *
+   * @exception IllegalStateException If already connected
+   * @exception NullPointerException If key is null
+   *
    * @see URLConnection:getRequestProperty(String key)
-   * @see URLConnection:addRequestProperty/String key, String value)
+   * @see URLConnection:addRequestProperty(String key, String value)
    */
   public void setRequestProperty(String key, String value)
   {
+    if (connected)
+      throw new IllegalStateException ("Already connected");
+
     // Do nothing unless overridden by subclasses that support setting
     // header fields in the request.
   }
@@ -447,6 +478,9 @@
    * @param key Key of the property to add
    * @param value Value of the Property to add
    * 
+   * @exception IllegalStateException If already connected
+   * @exception NullPointerException If key is null
+   * 
    * @see URLConnection:getRequestProperty(String key)
    * @see URLConnection:setRequestProperty(String key, String value)
    * 
@@ -454,6 +488,9 @@
    */
   public void addRequestProperty(String key, String value)
   {
+    if (connected)
+      throw new IllegalStateException ("Already connected");
+
     if (getRequestProperty (key) == null)
       {
         setRequestProperty (key, value);
@@ -465,6 +502,8 @@
    *
    * @param key Key of the property to return
    *
+   * @exception IllegalStateException If already connected
+   *
    * @see URLConnection:setRequestProperty(String key, String value)
    * @see URLConnection:addRequestProperty(String key, String value)
    * 
@@ -472,6 +511,9 @@
    */
   public String getRequestProperty(String key)
   {
+    if (connected)
+      throw new IllegalStateException ("Already connected");
+
     // Overridden by subclasses that support reading header fields from the
     // request.
     return null;
@@ -480,6 +522,8 @@
   /**
    * Returns a map that contains all properties of the request
    *
+   * @exception IllegalStateException If already connected
+   *
    * @return The map of properties
    */
   public Map getRequestProperties()
@@ -526,6 +570,10 @@
    * Sets a ContentHandlerFactory
    *
    * @param fac The ContentHandlerFactory
+   *
+   * @exception Error If the factory has already been defined
+   * @exception SecurityException If a security manager exists and its
+   * checkSetFactory method doesn't allow the operation
    */
   public static void setContentHandlerFactory(ContentHandlerFactory fac)
   {
@@ -545,8 +593,10 @@
    * specified file name
    *
    * @param fname The filename to guess the content type from
+   *
+   * @specnote public since JDK 1.4
    */
-  protected static String guessContentTypeFromName(String fname)
+  public static String guessContentTypeFromName(String fname)
   {
     int dot = fname.lastIndexOf (".");
     
@@ -597,6 +647,9 @@
    * Sets a FileNameMap
    *
    * @param map The new FileNameMap
+   *
+   * @exception SecurityException If a security manager exists and its
+   * checkSetFactory method doesn't allow the operation
    * 
    * @since 1.2
    */
Index: java/net/URLDecoder.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URLDecoder.java,v
retrieving revision 1.6
diff -u -b -r1.6 URLDecoder.java
--- java/net/URLDecoder.java	22 Jan 2002 22:40:23 -0000	1.6
+++ java/net/URLDecoder.java	24 Sep 2002 13:32:17 -0000
@@ -39,7 +39,7 @@
 
 import java.io.UnsupportedEncodingException;
 
- /**
+/**
   * This utility class contains static methods that converts a 
   * string encoded in the x-www-form-urlencoded format to the original
   * text.  The x-www-form-urlencoded format replaces certain disallowed
@@ -63,6 +63,13 @@
 public class URLDecoder
 {
  /**
+   * Constructor for compatibility with Sun's JDK.
+   */
+  public URLDecoder ()
+  {
+  }
+
+  /**
   * This method translates the passed in string from x-www-form-urlencoded
   * format using the default encoding "UTF-8" to decode the hex encoded
   * unsafe characters.
@@ -88,7 +95,7 @@
   * This method translates the passed in string from x-www-form-urlencoded
   * format using the given character encoding to decode the hex encoded
   * unsafe characters.
-  * <p>
+   *
   * This implementation will decode the string even if it contains
   * unsafe characters (characters that should have been encoded) or if the
   * two characters following a % do not represent a hex encoded byte.
@@ -101,6 +108,9 @@
   *
   * @return the converted String
   *
+   * @exception UnsupportedEncodingException If the named encoding is not
+   * supported
+   *
   * @since 1.4
   */
   public static String decode(String s, String encoding)
Index: java/net/URLEncoder.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URLEncoder.java,v
retrieving revision 1.5
diff -u -b -r1.5 URLEncoder.java
--- java/net/URLEncoder.java	22 Jan 2002 22:40:23 -0000	1.5
+++ java/net/URLEncoder.java	24 Sep 2002 13:32:17 -0000
@@ -94,6 +94,9 @@
    *
    * @return The converted String
    *
+   * @exception UnsupportedEncodingException If the named encoding is not
+   * supported
+   *
    * @since 1.4
    */
   public static String encode(String s, String encoding)
Index: java/net/natPlainDatagramSocketImpl.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/natPlainDatagramSocketImpl.cc,v
retrieving revision 1.46
diff -u -b -r1.46 natPlainDatagramSocketImpl.cc
--- java/net/natPlainDatagramSocketImpl.cc	21 Sep 2002 06:59:20 -0000	1.46
+++ java/net/natPlainDatagramSocketImpl.cc	24 Sep 2002 13:32:18 -0000
@@ -86,6 +86,20 @@
     JvNewStringLatin1 ("DatagramSocketImpl.bind: unimplemented"));
 }
 
+void
+java::net::PlainDatagramSocketImpl::connect (java::net::InetAddress *, jint)
+{
+  throw new java::io::SocketException (
+    JvNewStringLatin1 ("DatagramSocketImpl.connect: unimplemented"));
+}
+
+void
+java::net::PlainDatagramSocketImpl::disconnect ()
+{
+  throw new java::io::SocketException (
+    JvNewStringLatin1 ("DatagramSocketImpl.disconnect: unimplemented"));
+}
+
 jint
 java::net::PlainDatagramSocketImpl::peek (java::net::InetAddress *)
 {
@@ -263,6 +277,21 @@
  error:
   char* strerr = strerror (errno);
   throw new java::net::BindException (JvNewStringUTF (strerr));
+}
+
+void
+java::net::PlainDatagramSocketImpl::connect (java::net::InetAddress *addr,
+		                             jint  port)
+{ 
+  throw new ::java::lang::InternalError (
+    JvNewStringLatin1 ("PlainDatagramSocketImpl::connect: not implemented yet"));
+}
+
+void
+java::net::PlainDatagramSocketImpl::disconnect ()
+{
+  throw new ::java::lang::InternalError (
+    JvNewStringLatin1 ("PlainDatagramSocketImpl::disconnect: not implemented yet"));
 }
 
 jint
Index: javax/naming/RefAddr.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/naming/RefAddr.java,v
retrieving revision 1.5
diff -u -b -r1.5 RefAddr.java
--- javax/naming/RefAddr.java	16 Sep 2002 09:46:37 -0000	1.5
+++ javax/naming/RefAddr.java	24 Sep 2002 13:32:18 -0000
@@ -61,7 +61,7 @@
    * The string resprenstation of the type of address.
    * Set by the constructor and returned by the getType() method.
    */
-  protected final String addrType;
+  protected String addrType;
 
   /**
    * Protected constructor for use by subclasses.
@@ -98,7 +98,7 @@
    *         is the same as this addrType and the content is equals to the
    *         content of this object.
    */
-  public boolean equal(Object o)
+  public boolean equals(Object o)
   {
     if (o instanceof RefAddr)
       {
Index: javax/naming/BinaryRefAddr.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/naming/BinaryRefAddr.java,v
retrieving revision 1.4
diff -u -b -r1.4 BinaryRefAddr.java
--- javax/naming/BinaryRefAddr.java	16 Sep 2002 09:46:37 -0000	1.4
+++ javax/naming/BinaryRefAddr.java	24 Sep 2002 13:32:18 -0000
@@ -97,7 +97,7 @@
    *         the addrType is the same as this addrType and the bytes of the
    *         content are the same.
    */
-  public boolean equal(Object o)
+  public boolean equals(Object o)
   {
     if (o instanceof BinaryRefAddr)
       {

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