Commit f4758678 by Michael Koch Committed by Michael Koch

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.

From-SVN: r72229
parent e55f4a34
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-08 Arnaud Vandyck <arnaud.vandyck@ulg.ac.be> 2003-10-08 Arnaud Vandyck <arnaud.vandyck@ulg.ac.be>
* javax/swing/table/AbstractTableModel.java * javax/swing/table/AbstractTableModel.java
......
...@@ -92,11 +92,11 @@ public abstract class Preferences { ...@@ -92,11 +92,11 @@ public abstract class Preferences {
* Default PreferencesFactory class used when the system property * Default PreferencesFactory class used when the system property
* "java.util.prefs.PreferencesFactory" is not set. * "java.util.prefs.PreferencesFactory" is not set.
* <p> * <p>
* XXX - Currently set to MemoryBasedPreferencesFactory, should be changed * XXX - Currently set to MemoryBasedFactory, should be changed
* when FileBasedPreferences backend works. * when FileBasedPreferences backend works.
*/ */
private static final String defaultFactoryClass private static final String defaultFactoryClass
= "gnu.java.util.prefs.MemoryBasedPreferencesFactory"; = "gnu.java.util.prefs.MemoryBasedFactory";
/** Permission needed to access system or user root. */ /** Permission needed to access system or user root. */
private static final Permission prefsPermission private static final Permission prefsPermission
...@@ -210,18 +210,23 @@ public abstract class Preferences { ...@@ -210,18 +210,23 @@ public abstract class Preferences {
}); });
// Still no factory? Use our default. // Still no factory? Use our default.
if (factory == null) { if (factory == null)
try { {
Object o = Class.forName(defaultFactoryClass); try
factory = (PreferencesFactory) o; {
} catch (ClassNotFoundException cnfe) { Class cls = Class.forName (defaultFactoryClass);
throw new RuntimeException("Couldn't load default factory" factory = (PreferencesFactory) cls.newInstance();
}
catch (Exception e)
{
throw new RuntimeException ("Couldn't load default factory"
+ " '"+ defaultFactoryClass +"'"); + " '"+ defaultFactoryClass +"'");
// XXX - when using 1.4 compatible throwables add cause // XXX - when using 1.4 compatible throwables add cause
} }
} }
} }
return factory; return factory;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment