[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: Small cleanups

Kaffe CVS cvs-commits at kaffe.org
Sat Oct 16 06:35:01 PDT 2004


PatchSet 5300 
Date: 2004/10/16 13:30:57
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: Small cleanups

2004-10-15  Dalibor Topic <robilad at kaffe.org>

        * libraries/javalib/java/net/HttpURLConnection.java,
        libraries/javalib/java/net/MimeTypeMapper.java,
        libraries/javalib/java/net/NetworkInterface.java,
        libraries/javalib/java/net/PasswordAuthentication.java,
        libraries/javalib/java/net/ServerSocket.java,
        libraries/javalib/java/net/Socket.java,
        libraries/javalib/java/net/SocketPermission.java,
        libraries/javalib/java/net/URI.java,
        libraries/javalib/java/net/URL.java,
        libraries/javalib/java/net/URLStreamHandler.java:
        Resynced with GNU Classpath.

        2004-10-15  Michael Koch  <konqueror at gmx.de>

        * java/net/HttpURLConnection.java: Removed redundant parenthesis.
        * java/net/MimeTypeMapper.java: Reformatted.
        * java/net/NetworkInterface.java: Added comment to empty catch block.
        * java/net/PasswordAuthentication.java: Reformatted.
        * java/net/ServerSocket.java: Added comment to empty catch block.
        * java/net/Socket.java: Reworked import statements.
        * java/net/SocketPermission.java: Removed redundant parenthesis.
        * java/net/URI.java: Removed redundant parenthesis.
        * java/net/URL.java: Reworked import statements.
        * java/net/URLStreamHandler.java: Removed redundant semicolon.

Members: 
	ChangeLog:1.2852->1.2853 
	libraries/javalib/java/net/HttpURLConnection.java:1.11->1.12 
	libraries/javalib/java/net/MimeTypeMapper.java:1.2->1.3 
	libraries/javalib/java/net/NetworkInterface.java:1.8->1.9 
	libraries/javalib/java/net/PasswordAuthentication.java:1.3->1.4 
	libraries/javalib/java/net/ServerSocket.java:1.28->1.29 
	libraries/javalib/java/net/Socket.java:1.37->1.38 
	libraries/javalib/java/net/SocketPermission.java:1.6->1.7 
	libraries/javalib/java/net/URI.java:1.8->1.9 
	libraries/javalib/java/net/URL.java:1.48->1.49 
	libraries/javalib/java/net/URLStreamHandler.java:1.19->1.20 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2852 kaffe/ChangeLog:1.2853
--- kaffe/ChangeLog:1.2852	Fri Oct 15 19:00:28 2004
+++ kaffe/ChangeLog	Sat Oct 16 13:30:57 2004
@@ -1,5 +1,32 @@
 2004-10-15  Dalibor Topic <robilad at kaffe.org>
 
+	* libraries/javalib/java/net/HttpURLConnection.java,
+	libraries/javalib/java/net/MimeTypeMapper.java,
+	libraries/javalib/java/net/NetworkInterface.java,
+	libraries/javalib/java/net/PasswordAuthentication.java,
+	libraries/javalib/java/net/ServerSocket.java,
+	libraries/javalib/java/net/Socket.java,
+	libraries/javalib/java/net/SocketPermission.java,
+	libraries/javalib/java/net/URI.java,
+	libraries/javalib/java/net/URL.java,
+	libraries/javalib/java/net/URLStreamHandler.java:
+	Resynced with GNU Classpath.
+
+	2004-10-15  Michael Koch  <konqueror at gmx.de>
+
+        * java/net/HttpURLConnection.java: Removed redundant parenthesis.
+        * java/net/MimeTypeMapper.java: Reformatted.
+        * java/net/NetworkInterface.java: Added comment to empty catch block.
+        * java/net/PasswordAuthentication.java: Reformatted.
+        * java/net/ServerSocket.java: Added comment to empty catch block.
+        * java/net/Socket.java: Reworked import statements.
+        * java/net/SocketPermission.java: Removed redundant parenthesis.
+        * java/net/URI.java: Removed redundant parenthesis.
+        * java/net/URL.java: Reworked import statements.
+        * java/net/URLStreamHandler.java: Removed redundant semicolon.
+
+2004-10-15  Dalibor Topic <robilad at kaffe.org>
+
 	* libraries/clib/net/PlainDatagramSocketImpl.c:
 	(gnu_java_net_PlainDatagramSocketImpl_receive0) Adapted
 	to use public constructor.
Index: kaffe/libraries/javalib/java/net/HttpURLConnection.java
diff -u kaffe/libraries/javalib/java/net/HttpURLConnection.java:1.11 kaffe/libraries/javalib/java/net/HttpURLConnection.java:1.12
--- kaffe/libraries/javalib/java/net/HttpURLConnection.java:1.11	Tue Oct 12 00:24:59 2004
+++ kaffe/libraries/javalib/java/net/HttpURLConnection.java	Sat Oct 16 13:30:59 2004
@@ -1,5 +1,5 @@
-/* HttpURLConnection.java - Subclass of communications links using
-                            Hypertext Transfer Protocol.
+/* HttpURLConnection.java -- Subclass of communications links using
+   Hypertext Transfer Protocol.
    Copyright (C) 1998, 1999, 2000, 2002, 2003  Free Software Foundation
 
 This file is part of GNU Classpath.
@@ -537,7 +537,7 @@
   public InputStream getErrorStream()
   {
     if (! connected)
-      return (null);
+      return null;
 
     int code;
     try
@@ -550,10 +550,10 @@
       }
 
     if (code == -1)
-      return (null);
+      return null;
 
     if (((code / 100) != 4) || ((code / 100) != 5))
-      return (null);
+      return null;
 
     try
       {
@@ -561,14 +561,14 @@
 
 	int i = pbis.read();
 	if (i == -1)
-	  return (null);
+	  return null;
 
 	pbis.unread(i);
-	return (pbis);
+	return pbis;
       }
     catch (IOException e)
       {
-	return (null);
+	return null;
       }
   }
 
Index: kaffe/libraries/javalib/java/net/MimeTypeMapper.java
diff -u kaffe/libraries/javalib/java/net/MimeTypeMapper.java:1.2 kaffe/libraries/javalib/java/net/MimeTypeMapper.java:1.3
--- kaffe/libraries/javalib/java/net/MimeTypeMapper.java:1.2	Mon May 17 22:25:05 2004
+++ kaffe/libraries/javalib/java/net/MimeTypeMapper.java	Sat Oct 16 13:30:59 2004
@@ -41,25 +41,19 @@
 
 
 /**
-  * This non-public class is used to implement the FileNameMap interface
-  * which defines a mechanism for mapping filenames to MIME types.
-  *
-  * @version 0.5
-  *
-  * @author Aaron M. Renn (arenn at urbanophile.com)
-  */
+ * This non-public class is used to implement the FileNameMap interface
+ * which defines a mechanism for mapping filenames to MIME types.
+ *
+ * @version 0.5
+ *
+ * @author Aaron M. Renn (arenn at urbanophile.com)
+ */
 class MimeTypeMapper implements FileNameMap
 {
-/*************************************************************************/
-
-/*
- * Class Variables
- */
-
-/**
-  * This array of strings is used to identify a MIME type based on a file
-  * extension.  This is list is based on the Apache mime.types file.
-  */
+  /**
+   * This array of strings is used to identify a MIME type based on a file
+   * extension.  This is list is based on the Apache mime.types file.
+   */
   protected static final String[][] mime_strings =
     {
       { "application/mac-binhex40", "hqx" },
@@ -169,63 +163,51 @@
       { "x-world/x-vrml", "vrml" }
     };
 
-/**
-  * The MIME types above are put into this Hashtable for faster lookup.
-  */
+  /**
+   * The MIME types above are put into this Hashtable for faster lookup.
+   */
   private static Hashtable mime_types = new Hashtable(150);
 
-// Static initializer to load MIME types into Hashtable
+  // Static initializer to load MIME types into Hashtable
   static
-    {
-      for (int i = 0; i < mime_strings.length; i++)
-	mime_types.put(mime_strings[i][1], mime_strings[i][0]);
-    }
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
+  {
+    for (int i = 0; i < mime_strings.length; i++)
+      mime_types.put(mime_strings[i][1], mime_strings[i][0]);
+  }
 
-/**
-  * A do nothing constructor
-  */
+  /**
+   * Create a new <code>MimeTypeMapper</code> object.
+   */
   public MimeTypeMapper()
   {
-    ;
+    // Do nothing here.
   }
 
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
-  * The method returns the MIME type of the filename passed as an argument.
-  * The value returned is based on the extension of the filename.  The
-  * default content type returned if this method cannot determine the
-  * actual content type is "application/octet-stream"
-  *
-  * @param filename The name of the file to return the MIME type for
-  *
-  * @return The MIME type
-  */
+  /**
+   * The method returns the MIME type of the filename passed as an argument.
+   * The value returned is based on the extension of the filename.  The
+   * default content type returned if this method cannot determine the
+   * actual content type is "application/octet-stream"
+   *
+   * @param filename The name of the file to return the MIME type for
+   *
+   * @return The MIME type
+   */
   public String getContentTypeFor(String filename)
   {
     int index = filename.lastIndexOf(".");
     if (index != -1)
       {
 	if (index == filename.length())
-	  return ("application/octet-stream");
+	  return "application/octet-stream";
 	else
 	  filename = filename.substring(index + 1);
       }
 
     String type = (String) mime_types.get(filename);
     if (type == null)
-      return ("application/octet-stream");
+      return "application/octet-stream";
     else
-      return (type);
+      return type;
   }
-} // class MimeTypeMapper
+}
Index: kaffe/libraries/javalib/java/net/NetworkInterface.java
diff -u kaffe/libraries/javalib/java/net/NetworkInterface.java:1.8 kaffe/libraries/javalib/java/net/NetworkInterface.java:1.9
--- kaffe/libraries/javalib/java/net/NetworkInterface.java:1.8	Sun May 23 21:22:20 2004
+++ kaffe/libraries/javalib/java/net/NetworkInterface.java	Sat Oct 16 13:31:00 2004
@@ -1,4 +1,4 @@
-/* NetworkInterface.java
+/* NetworkInterface.java --
    Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -49,7 +49,7 @@
  * For example, an ethernet interface may be named "eth0" and have the
  * address 192.168.1.101 assigned to it.
  *
- * @author Michael Koch <konqueror at gmx.de>
+ * @author Michael Koch (konqueror at gmx.de)
  * @since 1.4
  */
 public final class NetworkInterface
@@ -113,6 +113,7 @@
 	  }
 	catch (SecurityException e)
 	  {
+	    // Ignore.
 	  }
       }
 
Index: kaffe/libraries/javalib/java/net/PasswordAuthentication.java
diff -u kaffe/libraries/javalib/java/net/PasswordAuthentication.java:1.3 kaffe/libraries/javalib/java/net/PasswordAuthentication.java:1.4
--- kaffe/libraries/javalib/java/net/PasswordAuthentication.java:1.3	Mon May 17 22:25:06 2004
+++ kaffe/libraries/javalib/java/net/PasswordAuthentication.java	Sat Oct 16 13:31:00 2004
@@ -39,69 +39,54 @@
 
 
 /**
-  * This class serves a container for username/password pairs.
-  *
-  * @author Aaron M. Renn (arenn at urbanophile.com)
-  * @since 1.2
-  */
+ * This class serves a container for username/password pairs.
+ *
+ * @author Aaron M. Renn (arenn at urbanophile.com)
+ *
+ * @since 1.2
+ */
 public final class PasswordAuthentication
 {
-  /*
-   * Instance Variables
-   */
-
   /**
-    * The username
-    */
+   * The username
+   */
   private String username;
 
   /**
-    * The password
-    */
-  private char[] password;
-
-  /*************************************************************************/
-
-  /*
-   * Constructors
+   * The password
    */
+  private char[] password;
 
   /**
-    * Creates a new <code>PasswordAuthentication</code> object from the
-    * specified username and password.
-    *
-    * @param username The username for this object
-    * @param password The password for this object
-    */
+   * Creates a new <code>PasswordAuthentication</code> object from the
+   * specified username and password.
+   *
+   * @param username The username for this object
+   * @param password The password for this object
+   */
   public PasswordAuthentication(String username, char[] password)
   {
     this.username = username;
     this.password = password;
   }
 
-  /*************************************************************************/
-
-  /*
-   * Instance Methods
-   */
-
   /**
-    * Returns the username associated with this object
-    *
-    * @return The username
-    */
+   * Returns the username associated with this object
+   *
+   * @return The username
+   */
   public String getUserName()
   {
-    return (username);
+    return username;
   }
 
   /**
-    * Returns the password associated with this object
-    *
-    * @return The password
-    */
+   * Returns the password associated with this object
+   *
+   * @return The password
+   */
   public char[] getPassword()
   {
-    return (password);
+    return password;
   }
-} // class PasswordAuthentication
+}
Index: kaffe/libraries/javalib/java/net/ServerSocket.java
diff -u kaffe/libraries/javalib/java/net/ServerSocket.java:1.28 kaffe/libraries/javalib/java/net/ServerSocket.java:1.29
--- kaffe/libraries/javalib/java/net/ServerSocket.java:1.28	Wed Sep 15 09:25:51 2004
+++ kaffe/libraries/javalib/java/net/ServerSocket.java	Sat Oct 16 13:31:00 2004
@@ -39,6 +39,7 @@
 package java.net;
 
 import gnu.java.net.PlainSocketImpl;
+
 import java.io.IOException;
 import java.nio.channels.IllegalBlockingModeException;
 import java.nio.channels.ServerSocketChannel;
@@ -340,6 +341,7 @@
 	  }
 	catch (IOException e2)
 	  {
+	    // Ignore.
 	  }
 
 	throw e;
Index: kaffe/libraries/javalib/java/net/Socket.java
diff -u kaffe/libraries/javalib/java/net/Socket.java:1.37 kaffe/libraries/javalib/java/net/Socket.java:1.38
--- kaffe/libraries/javalib/java/net/Socket.java:1.37	Wed Sep 15 09:25:51 2004
+++ kaffe/libraries/javalib/java/net/Socket.java	Sat Oct 16 13:31:00 2004
@@ -39,6 +39,7 @@
 package java.net;
 
 import gnu.java.net.PlainSocketImpl;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
Index: kaffe/libraries/javalib/java/net/SocketPermission.java
diff -u kaffe/libraries/javalib/java/net/SocketPermission.java:1.6 kaffe/libraries/javalib/java/net/SocketPermission.java:1.7
--- kaffe/libraries/javalib/java/net/SocketPermission.java:1.6	Mon Jul 26 21:13:57 2004
+++ kaffe/libraries/javalib/java/net/SocketPermission.java	Sat Oct 16 13:31:00 2004
@@ -40,7 +40,6 @@
 import java.io.Serializable;
 import java.security.Permission;
 import java.security.PermissionCollection;
-import java.util.StringTokenizer;
 
 
 /**
@@ -152,13 +151,13 @@
   public boolean equals(Object obj)
   {
     if (! (obj instanceof SocketPermission))
-      return (false);
+      return false;
 
     if (((SocketPermission) obj).hostport.equals(hostport))
       if (((SocketPermission) obj).actions.equals(actions))
-	return (true);
+	return true;
 
-    return (false);
+    return false;
   }
 
   /**
@@ -217,7 +216,7 @@
     else if (actions.indexOf("resolve") != -1)
       sb.append("resolve");
 
-    return (sb.toString());
+    return sb.toString();
   }
 
   /**
@@ -230,7 +229,7 @@
   {
     // FIXME: Implement
 
-    return (null);
+    return null;
   }
 
   /**
@@ -266,18 +265,14 @@
     if (perm instanceof SocketPermission)
       p = (SocketPermission) perm;
     else
-      return (false);
+      return false;
 
     // Next check the actions
     String ourlist = getActions();
     String theirlist = p.getActions();
 
-    StringTokenizer tok = new StringTokenizer (theirlist, ",");
-    while (tok.hasMoreTokens())
-      {
-        if (ourlist.indexOf (tok.nextToken()) < 0)
-          return false;
-      }
+    if (! ourlist.startsWith(theirlist))
+      return false;
 
     // Now check ports
     int ourfirstport = 0;
@@ -352,7 +347,7 @@
 
     // Now check them
     if ((theirfirstport < ourfirstport) || (theirlastport > ourlastport))
-      return (false);
+      return false;
 
     // Finally we can check the hosts
     String ourhost;
@@ -374,7 +369,7 @@
 
     // Are they equal?
     if (ourhost.equals(theirhost))
-      return (true);
+      return true;
 
     // Try the canonical names
     String ourcanonical = null;
@@ -397,17 +392,17 @@
       }
 
     if (ourcanonical.equals(theircanonical))
-      return (true);
+      return true;
 
     // Well, last chance.  Try for a wildcard
     if (ourhost.indexOf("*.") != -1)
       {
 	String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1));
 	if (theircanonical.endsWith(wild_domain))
-	  return (true);
+	  return true;
       }
 
     // Didn't make it
-    return (false);
+    return false;
   }
 }
Index: kaffe/libraries/javalib/java/net/URI.java
diff -u kaffe/libraries/javalib/java/net/URI.java:1.8 kaffe/libraries/javalib/java/net/URI.java:1.9
--- kaffe/libraries/javalib/java/net/URI.java:1.8	Wed Aug 18 19:58:30 2004
+++ kaffe/libraries/javalib/java/net/URI.java	Sat Oct 16 13:31:00 2004
@@ -1,4 +1,4 @@
-/* URI.java - An URI class
+/* URI.java - An URI class --
    Copyright (C) 2002, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -134,14 +134,14 @@
   {
     this.string = (String) is.readObject();
     try
-    {
-      parseURI(this.string);
-    }
+      {
+	parseURI(this.string);
+      }
     catch (URISyntaxException x)
-    {
-      // Should not happen.
-      throw new RuntimeException(x);
-    }
+      {
+	// Should not happen.
+	throw new RuntimeException(x);
+      }
   }
 
   private void writeObject(ObjectOutputStream os) throws IOException
@@ -618,7 +618,7 @@
    */
   public boolean isAbsolute()
   {
-    return (scheme != null);
+    return scheme != null;
   }
 
   /**
Index: kaffe/libraries/javalib/java/net/URL.java
diff -u kaffe/libraries/javalib/java/net/URL.java:1.48 kaffe/libraries/javalib/java/net/URL.java:1.49
--- kaffe/libraries/javalib/java/net/URL.java:1.48	Thu Oct 14 22:51:59 2004
+++ kaffe/libraries/javalib/java/net/URL.java	Sat Oct 16 13:31:00 2004
@@ -39,13 +39,14 @@
 package java.net;
 
 import gnu.java.net.URLParseError;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.HashMap;
 import java.util.StringTokenizer;
 
Index: kaffe/libraries/javalib/java/net/URLStreamHandler.java
diff -u kaffe/libraries/javalib/java/net/URLStreamHandler.java:1.19 kaffe/libraries/javalib/java/net/URLStreamHandler.java:1.20
--- kaffe/libraries/javalib/java/net/URLStreamHandler.java:1.19	Mon Jul 12 04:22:00 2004
+++ kaffe/libraries/javalib/java/net/URLStreamHandler.java	Sat Oct 16 13:31:00 2004
@@ -180,8 +180,8 @@
 	      }
 	    catch (NumberFormatException e)
 	      {
-		; // Ignore invalid port values; port is already set to u's
-		  // port.
+		// Ignore invalid port values; port is already set to u's
+		// port.
 	      }
 
 	    // Now we must cut the port number in the original string.




More information about the kaffe mailing list