92 |
* Default PreferencesFactory class used when the system property |
* Default PreferencesFactory class used when the system property |
93 |
* "java.util.prefs.PreferencesFactory" is not set. |
* "java.util.prefs.PreferencesFactory" is not set. |
94 |
* <p> |
* <p> |
95 |
* XXX - Currently set to MemoryBasedPreferencesFactory, should be changed |
* XXX - Currently set to MemoryBasedFactory, should be changed |
96 |
* when FileBasedPreferences backend works. |
* when FileBasedPreferences backend works. |
97 |
*/ |
*/ |
98 |
private static final String defaultFactoryClass |
private static final String defaultFactoryClass |
99 |
= "gnu.java.util.prefs.MemoryBasedPreferencesFactory"; |
= "gnu.java.util.prefs.MemoryBasedFactory"; |
100 |
|
|
101 |
/** Permission needed to access system or user root. */ |
/** Permission needed to access system or user root. */ |
102 |
private static final Permission prefsPermission |
private static final Permission prefsPermission |
210 |
}); |
}); |
211 |
|
|
212 |
// Still no factory? Use our default. |
// Still no factory? Use our default. |
213 |
if (factory == null) { |
if (factory == null) |
214 |
try { |
{ |
215 |
Object o = Class.forName(defaultFactoryClass); |
try |
216 |
factory = (PreferencesFactory) o; |
{ |
217 |
} catch (ClassNotFoundException cnfe) { |
Object o = Class.forName (defaultFactoryClass); |
218 |
throw new RuntimeException("Couldn't load default factory" |
factory = (PreferencesFactory) o.newInstance(); |
219 |
|
} |
220 |
|
catch (Exception e) |
221 |
|
{ |
222 |
|
throw new RuntimeException ("Couldn't load default factory" |
223 |
+ " '"+ defaultFactoryClass +"'"); |
+ " '"+ defaultFactoryClass +"'"); |
224 |
// XXX - when using 1.4 compatible throwables add cause |
// XXX - when using 1.4 compatible throwables add cause |
225 |
} |
} |
226 |
} |
} |
227 |
|
|
228 |
} |
} |
229 |
|
|
230 |
return factory; |
return factory; |
231 |
} |
} |
232 |
|
|