< prev index next >

src/java.prefs/share/classes/java/util/prefs/Preferences.java

Print this page

        

*** 236,262 **** // FIXME: This code should be run in a doPrivileged and // not use the context classloader, to avoid being // dependent on the invoking thread. // Checking AllPermission also seems wrong. try { ! return (PreferencesFactory) ! Class.forName(factoryName, false, ClassLoader.getSystemClassLoader()) .newInstance(); } catch (Exception ex) { try { // workaround for javaws, plugin, // load factory class using non-system classloader SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new java.security.AllPermission()); } ! return (PreferencesFactory) ! Class.forName(factoryName, false, Thread.currentThread() .getContextClassLoader()) .newInstance(); } catch (Exception e) { throw new InternalError( "Can't instantiate Preferences factory " + factoryName, e); } --- 236,264 ---- // FIXME: This code should be run in a doPrivileged and // not use the context classloader, to avoid being // dependent on the invoking thread. // Checking AllPermission also seems wrong. try { ! @SuppressWarnings("deprecation") ! Object result =Class.forName(factoryName, false, ClassLoader.getSystemClassLoader()) .newInstance(); + return (PreferencesFactory)result; } catch (Exception ex) { try { // workaround for javaws, plugin, // load factory class using non-system classloader SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new java.security.AllPermission()); } ! @SuppressWarnings("deprecation") ! Object result = Class.forName(factoryName, false, Thread.currentThread() .getContextClassLoader()) .newInstance(); + return (PreferencesFactory) result; } catch (Exception e) { throw new InternalError( "Can't instantiate Preferences factory " + factoryName, e); }
*** 297,309 **** platformFactory = "java.util.prefs.MacOSXPreferencesFactory"; } else { platformFactory = "java.util.prefs.FileSystemPreferencesFactory"; } try { ! return (PreferencesFactory) ! Class.forName(platformFactory, false, Preferences.class.getClassLoader()).newInstance(); } catch (Exception e) { throw new InternalError( "Can't instantiate platform default Preferences factory " + platformFactory, e); } --- 299,312 ---- platformFactory = "java.util.prefs.MacOSXPreferencesFactory"; } else { platformFactory = "java.util.prefs.FileSystemPreferencesFactory"; } try { ! @SuppressWarnings("deprecation") ! Object result = Class.forName(platformFactory, false, Preferences.class.getClassLoader()).newInstance(); + return (PreferencesFactory) result; } catch (Exception e) { throw new InternalError( "Can't instantiate platform default Preferences factory " + platformFactory, e); }
< prev index next >