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
This commit is contained in:
Michael Koch 2003-10-08 15:30:21 +00:00 committed by Michael Koch
parent e55f4a3413
commit f475867806
2 changed files with 22 additions and 10 deletions

View File

@ -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-08 Arnaud Vandyck <arnaud.vandyck@ulg.ac.be>
* javax/swing/table/AbstractTableModel.java

View File

@ -92,11 +92,11 @@ public abstract class Preferences {
* 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 @@ public abstract class Preferences {
});
// 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;
}