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.URL


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

Hi list,


I commited the attached patch to trunk. It cleans up java.net.URL to a 
state where I think further merging with classpath isn't useful. 
Others may have other opinions and should share them with the rest of 
us.


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

iD8DBQE/fBdPWSOgCCdjSDsRArrxAKCPERXOtBSF5cqlKlBsN3bLIzkkJQCgkXnd
KyI6O70zMwaMTspw0Ck0byk=
=nvCI
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2209
diff -u -b -B -r1.2209 ChangeLog
--- ChangeLog	2 Oct 2003 09:37:01 -0000	1.2209
+++ ChangeLog	2 Oct 2003 12:09:01 -0000
@@ -1,5 +1,13 @@
 2003-10-02  Michael Koch  <konqueror@gmx.de>
 
+	* java/net/URL.java
+	(DEFAULT_SEARCH_PATH): New static variable.
+	(ph_cache): Made it a HashMap.
+	(getURLStreamHandler): Rename propVal to ph_search_path and use
+	DEFAULT_SEARCH_PATH.
+
+2003-10-02  Michael Koch  <konqueror@gmx.de>
+
 	* javax/swing/table/AbstractTableModel.java
 	(findColumnName): Prevent from NullPointerException if argument
 	columnName is null.
Index: java/net/URL.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URL.java,v
retrieving revision 1.27
diff -u -b -B -r1.27 URL.java
--- java/net/URL.java	29 Sep 2003 11:24:28 -0000	1.27
+++ java/net/URL.java	2 Oct 2003 12:09:01 -0000
@@ -43,10 +43,9 @@
 import java.io.Serializable;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-import java.util.Hashtable;
+import java.util.HashMap;
 import java.util.StringTokenizer;
 
-
 /*
  * Written using on-line Java Platform 1.2 API Specification, as well
  * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
@@ -119,6 +118,9 @@
   */
 public final class URL implements Serializable
 {
+  private static final String DEFAULT_SEARCH_PATH =
+    "gnu.java.net.protocol|sun.net.www.protocol";
+  
   /**
    * The name of the protocol for this URL.
    * The protocol is always stored in lower case.
@@ -174,7 +176,7 @@
    * This a table where we cache protocol handlers to avoid the overhead
    * of looking them up each time.
    */
-  private static Hashtable ph_cache = new Hashtable();
+  private static HashMap ph_cache = new HashMap();
 
   /**
    * Whether or not to cache protocol handlers.
@@ -798,12 +800,16 @@
 	// to it, along with the JDK specified default as a last resort.
 	// Except in very unusual environments the JDK specified one shouldn't
 	// ever be needed (or available).
-	String propVal = System.getProperty("java.protocol.handler.pkgs");
-	propVal = (propVal == null) ? "" : (propVal + "|");
-	propVal = propVal + "gnu.gcj.protocol|sun.net.www.protocol";
+	String ph_search_path = System.getProperty ("java.protocol.handler.pkgs");
+
+	// Tack our default package on at the ends.
+	if (ph_search_path != null)
+          ph_search_path += "|" + DEFAULT_SEARCH_PATH;
+	else
+          ph_search_path = DEFAULT_SEARCH_PATH;
 
 	// Finally loop through our search path looking for a match.
-	StringTokenizer pkgPrefix = new StringTokenizer (propVal, "|");
+	StringTokenizer pkgPrefix = new StringTokenizer (ph_search_path, "|");
         
 	do
           {

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