if (factory == null) { Iterator iter = ServiceFactory.lookupProviders (PreferencesFactory.class, null);  if (iter != null && iter.hasNext()) factory = (PreferencesFactory) iter.next(); }
    private static PreferencesFactory getFactory() throws SecurityException {        // First check for permission        SecurityManager sm = System.getSecurityManager();        if (sm != null) {            sm.checkPermission(prefsPermission);        }        // Get the factory        if (factory == null) {            // Caller might not have enough permissions            factory = (PreferencesFactory) AccessController.doPrivileged(                        new PrivilegedAction() {                            public Object run() {                                PreferencesFactory pf = null;                                String className = System.getProperty                                    ("java.util.prefs.PreferencesFactory");                                if (className != null) {                                    try {                                        Class fc = Class.forName(className);                                        Object o = fc.newInstance();                                        pf = (PreferencesFactory) o;                                    } catch (ClassNotFoundException cnfe)                                        {/*ignore*/}                                    catch (InstantiationException ie)                                        {/*ignore*/}                                    catch (IllegalAccessException iae)                                        {/*ignore*/}                                    catch (ClassCastException cce)                                        {/*ignore*/}                                }                                return pf;                            }                        });            // Still no factory? Use our default.            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 +"'", e);                }            }        }	        return factory;    }