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: java.net - merging work


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

Hi list,


I commited the attached patch to trunk to merge java.net a little bit 
more with classpath.


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

iD8DBQE+sjqPWSOgCCdjSDsRAqMUAJ48If41fB1yEP4AvC935+pvygO1ewCdELEF
K3k2Gro5VOl1rRzoPqzRfAY=
=rZdQ
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1868
diff -u -r1.1868 ChangeLog
--- ChangeLog	2 May 2003 05:35:56 -0000	1.1868
+++ ChangeLog	2 May 2003 09:05:27 -0000
@@ -1,5 +1,17 @@
 2003-05-02  Michael Koch  <konqueror@gmx.de>
 
+	* java/net/InetAddress.java:
+	Merged class documentation with classpath.
+	* java/net/JarURLConnection.java:
+	Explicitely import all used classes.
+	* java/net/URL.java:
+	Reformatting.
+	* java/net/ServerSocket.java,
+	java/net/Socket.java:
+	New versions from classpath.
+
+2003-05-02  Michael Koch  <konqueror@gmx.de>
+
 	* gnu/java/nio/FileChannelImpl.java
 	(read): New implementation.
 	(implRead): New methods.
Index: java/net/InetAddress.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/InetAddress.java,v
retrieving revision 1.14
diff -u -r1.14 InetAddress.java
--- java/net/InetAddress.java	20 Mar 2003 08:19:57 -0000	1.14
+++ java/net/InetAddress.java	2 May 2003 09:05:27 -0000
@@ -44,20 +44,28 @@
 import java.io.Serializable;
 import java.io.ObjectStreamException;
 
-/**
- * @author Per Bothner
- * @date January 6, 1999.
- */
-
 /*
  * Written using on-line Java Platform 1.2 API Specification, as well
  * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
  * (The latter turns out to have some errors ...)
  * Status:  Believed complete and correct.
+ */
+
+/**
+ * This class models an Internet address.  It does not have a public
+ * constructor.  Instead, new instances of this objects are created
+ * using the static methods getLocalHost(), getByName(), and
+ * getAllByName().
+ * <p>
+ * This class fulfills the function of the C style functions gethostname(),
+ * gethostbyname(), and gethostbyaddr().  It resolves Internet DNS names
+ * into their corresponding numeric addresses and vice versa.
+ *
+ * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Per Bothner
  *
  * @specnote This class is not final since JK 1.4
  */
-
 public class InetAddress implements Serializable
 {
   // The Serialized Form specifies that an int 'address' is saved/restored.
Index: java/net/JarURLConnection.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/JarURLConnection.java,v
retrieving revision 1.12
diff -u -r1.12 JarURLConnection.java
--- java/net/JarURLConnection.java	20 Mar 2003 08:19:58 -0000	1.12
+++ java/net/JarURLConnection.java	2 May 2003 09:05:27 -0000
@@ -38,10 +38,16 @@
 
 package java.net;
 
-import java.net.*;
-import java.io.*;
-import java.util.jar.*;
-import java.util.zip.*;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarInputStream;
+import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
 import java.util.Map;
 import java.util.Vector;
 import java.util.Hashtable;
@@ -52,8 +58,6 @@
  * @since 1.2
  * @date Aug 10, 1999.
  */
-
-
 public abstract class JarURLConnection extends URLConnection
 {
   // three different ways to say the same thing
Index: java/net/ServerSocket.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/ServerSocket.java,v
retrieving revision 1.20
diff -u -r1.20 ServerSocket.java
--- java/net/ServerSocket.java	13 Feb 2003 07:33:39 -0000	1.20
+++ java/net/ServerSocket.java	2 May 2003 09:05:27 -0000
@@ -164,9 +164,50 @@
     if (bindAddr == null)
       bindAddr = InetAddress.ANY_IF;
 
+    // create socket
     impl.create(true);
-    impl.bind(bindAddr, port);
-    impl.listen(backlog);
+
+    // bind to address/port
+    try
+      {
+        impl.bind(bindAddr, port);
+      }
+    catch (IOException exception)
+      {
+        impl.close();
+        throw exception;
+      }
+    catch (RuntimeException exception)
+      {
+        impl.close();
+        throw exception;
+      }
+    catch (Error error)
+      {
+        impl.close();
+        throw error;
+      }
+
+    // listen on socket
+    try
+      {
+        impl.listen(backlog);
+      }
+    catch (IOException exception)
+      {
+        impl.close();
+        throw exception;
+      }
+    catch (RuntimeException exception)
+      {
+        impl.close();
+        throw exception;
+      }
+    catch (Error error)
+      {
+        impl.close();
+        throw error;
+      }
   }
 
   /**
Index: java/net/Socket.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/Socket.java,v
retrieving revision 1.21
diff -u -r1.21 Socket.java
--- java/net/Socket.java	10 Mar 2003 14:48:09 -0000	1.21
+++ java/net/Socket.java	2 May 2003 09:05:28 -0000
@@ -291,16 +291,59 @@
     if (sm != null)
       sm.checkConnect(raddr.getHostName(), rport);
 
+    // create socket
     impl.create(stream);
 
     // FIXME: JCL p. 1586 says if localPort is unspecified, bind to any port,
     // i.e. '0' and if localAddr is unspecified, use getLocalAddress() as
     // that default.  JDK 1.2 doc infers not to do a bind.
+    
+    // bind/connect to address/port
     if (laddr != null)
-      impl.bind(laddr, lport);
+      {
+        try
+	  {
+            impl.bind(laddr, lport);
+          }
+	catch (IOException exception)
+          {
+            impl.close();
+            throw exception;
+          }
+        catch (RuntimeException exception)
+          {
+            impl.close();
+            throw exception;
+          }
+        catch (Error error)
+          {
+            impl.close();
+            throw error;
+          }
+      }
 
     if (raddr != null)
-      impl.connect(raddr, rport);
+      {
+        try
+          {
+            impl.connect(raddr, rport);
+          }
+        catch (IOException exception)
+          {
+            impl.close();
+            throw exception;
+          }
+        catch (RuntimeException exception)
+          {
+            impl.close();
+            throw exception;
+          }
+        catch (Error error)
+          {
+            impl.close();
+            throw error;
+          }
+      }
   }
 
   /**
Index: java/net/URL.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URL.java,v
retrieving revision 1.18
diff -u -r1.18 URL.java
--- java/net/URL.java	10 Mar 2003 14:48:09 -0000	1.18
+++ java/net/URL.java	2 May 2003 09:05:33 -0000
@@ -99,7 +99,7 @@
   * Please note that a protocol handler must be a subclass of
   * URLStreamHandler.
   *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
+  * @author Aaron M. Renn <arenn@urbanophile.com>
   * @author Warren Levy <warrenl@cygnus.com>
   *
   * @see URLStreamHandler
@@ -720,7 +720,7 @@
   }
 
   private static synchronized URLStreamHandler
-    getURLStreamHandler(String protocol)
+    getURLStreamHandler (String protocol)
   {
     URLStreamHandler handler;
 

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