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.util.prefs.Preferences merge


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

Hi list,


I commited the attached patch to trunk to merge 
java.util.prefs.Preferences with classpath again.


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

iD8DBQE/hC9yWSOgCCdjSDsRAvXjAJ9ZRfH3DXvGijAdqQcdnR+orKIw+ACghFjB
ZuAWGQsMSsP3PQpPRRssI8U=
=2lP2
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2215
diff -u -b -B -r1.2215 ChangeLog
--- ChangeLog	2 Oct 2003 19:29:30 -0000	1.2215
+++ ChangeLog	8 Oct 2003 15:26:31 -0000
@@ -1,3 +1,10 @@
+2003-10-08  Michael Koch  <konqueror@gmx.de>
+
+	* java/util/prefs/Preferences.java
+	(defaultFactoryClass): Fixed class name.
+	(getFactory): Create instance of class returned by Class.forName(),
+	reformated code.
+
 2003-10-02  Guilhem Lavaux  <guilhem@kaffe.org>
 
 	* java/net/InetSocketAddress.java
Index: java/util/prefs/Preferences.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/prefs/Preferences.java,v
retrieving revision 1.2
diff -u -b -B -r1.2 Preferences.java
--- java/util/prefs/Preferences.java	17 Jun 2003 13:01:21 -0000	1.2
+++ java/util/prefs/Preferences.java	8 Oct 2003 15:26:32 -0000
@@ -92,11 +92,11 @@
      * Default PreferencesFactory class used when the system property
      * "java.util.prefs.PreferencesFactory" is not set.
 	 * <p>
-	 * XXX - Currently set to MemoryBasedPreferencesFactory, should be changed
+	 * XXX - Currently set to MemoryBasedFactory, should be changed
 	 * when FileBasedPreferences backend works.
      */
     private static final String defaultFactoryClass
-        = "gnu.java.util.prefs.MemoryBasedPreferencesFactory";
+        = "gnu.java.util.prefs.MemoryBasedFactory";
 
     /** Permission needed to access system or user root. */
     private static final Permission prefsPermission
@@ -210,18 +210,23 @@
                         });
 
             // Still no factory? Use our default.
-            if (factory == null) {
-                try {
-                    Object o = Class.forName(defaultFactoryClass);
-                    factory = (PreferencesFactory) o;
-                } catch (ClassNotFoundException cnfe) {
-                    throw new RuntimeException("Couldn't load default factory"
+            if (factory == null)
+	      {
+                try
+		  {
+                    Class cls = Class.forName (defaultFactoryClass);
+                    factory = (PreferencesFactory) cls.newInstance();
+                  }
+		catch (Exception e)
+		  {
+                    throw new RuntimeException ("Couldn't load default factory"
                         + " '"+ defaultFactoryClass +"'");
                     // XXX - when using 1.4 compatible throwables add cause
                 }
             }
 
         }
+	
         return factory;
     }
 

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