public static AuthConfigFactory getFactory()
   {
      //Validate the caller permission
      SecurityManager sm = System.getSecurityManager();
      if (sm != null)
         sm.checkPermission(getFactorySecurityPermission);

      if (_factory == null)
      {
          if (sm != null)
              sm.checkPermission(setFactorySecurityPermission);

         String factoryName = null;
         Class clazz = null;
         try
         {
            LoadAction action = new LoadAction();
            try
            {
               clazz = (Class) AccessController.doPrivileged(action);
               factoryName = action.getName();
            }
            catch (PrivilegedActionException ex)
            {
               factoryName = action.getName();
               Exception e = ex.getException();
               if (e instanceof ClassNotFoundException)
                  throw (ClassNotFoundException) e;
               else
                  throw new IllegalStateException("Failure during load of class: " + action.getName() + e);
            }
            _factory = (AuthConfigFactory) clazz.newInstance();
         }
         catch (ClassNotFoundException e)
         {
            String msg = "Failed to find AuthConfigFactory : " + factoryName;
            IllegalStateException ise = new IllegalStateException(msg);
            ise.initCause(e);
            throw ise;
         }
         catch (IllegalAccessException e)
         {
            String msg = "Unable to access class : " + factoryName;
            IllegalStateException ise = new IllegalStateException(msg);
            ise.initCause(e);
            throw ise;
         }
         catch (InstantiationException e)
         {
            String msg = "Failed to create instance of: " + factoryName;
            IllegalStateException ise = new IllegalStateException(msg);
            ise.initCause(e);
            throw ise;
         }
         catch (ClassCastException e)
         {
            StringBuffer msg = new StringBuffer(factoryName + " Is not a AuthConfigFactory, ");
            msg.append("ACF.class.CL: "+ AuthConfigFactory.class.getClassLoader());
            msg.append("\nACF.class.CS: " + AuthConfigFactory.class.getProtectionDomain().getCodeSource());
            msg.append("\nACF.class.hash: "+System.identityHashCode(AuthConfigFactory.class));
            msg.append("\nclazz.CL: "+clazz.getClassLoader());
            msg.append("\nclazz.CS: "+clazz.getProtectionDomain().getCodeSource());
            msg.append("\nclazz.super.CL: "+clazz.getSuperclass().getClassLoader());
            msg.append("\nclazz.super.CS: "+clazz.getSuperclass().getProtectionDomain().getCodeSource());
            msg.append("\nclazz.super.hash: "+System.identityHashCode(clazz.getSuperclass()));
            ClassCastException cce = new ClassCastException(msg.toString());
            cce.initCause(e);
            throw cce;
         }
      }
      return _factory;
   }
public static AuthConfigFactory getFactory ( ) { SecurityManager sm = System . getSecurityManager ( ) ; if ( sm != null ) sm . checkPermission ( getFactorySecurityPermission ) ; if ( _factory == null ) { if ( sm != null ) sm . checkPermission ( setFactorySecurityPermission ) ; String factoryName = null ; Class clazz = null ; try { LoadAction action = new LoadAction ( ) ; try { clazz = ( Class ) AccessController . doPrivileged ( action ) ; factoryName = action . getName ( ) ; } catch ( PrivilegedActionException ex ) { factoryName = action . getName ( ) ; Exception e = ex . getException ( ) ; if ( e instanceof ClassNotFoundException ) throw ( ClassNotFoundException ) e ; else throw new IllegalStateException ( "Failure during load of class: " + action . getName ( ) + e ) ; } _factory = ( AuthConfigFactory ) clazz . newInstance ( ) ; } catch ( ClassNotFoundException e ) { String msg = "Failed to find AuthConfigFactory : " + factoryName ; IllegalStateException ise = new IllegalStateException ( msg ) ; ise . initCause ( e ) ; throw ise ; } catch ( IllegalAccessException e ) { String msg = "Unable to access class : " + factoryName ; IllegalStateException ise = new IllegalStateException ( msg ) ; ise . initCause ( e ) ; throw ise ; } catch ( InstantiationException e ) { String msg = "Failed to create instance of: " + factoryName ; IllegalStateException ise = new IllegalStateException ( msg ) ; ise . initCause ( e ) ; throw ise ; } catch ( ClassCastException e ) { StringBuffer msg = new StringBuffer ( factoryName + " Is not a AuthConfigFactory, " ) ; msg . append ( "ACF.class.CL: " + AuthConfigFactory . class . getClassLoader ( ) ) ; msg . append ( "\nACF.class.CS: " + AuthConfigFactory . class . getProtectionDomain ( ) . getCodeSource ( ) ) ; msg . append ( "\nACF.class.hash: " + System . identityHashCode ( AuthConfigFactory . class ) ) ; msg . append ( "\nclazz.CL: " + clazz . getClassLoader ( ) ) ; msg . append ( "\nclazz.CS: " + clazz . getProtectionDomain ( ) . getCodeSource ( ) ) ; msg . append ( "\nclazz.super.CL: " + clazz . getSuperclass ( ) . getClassLoader ( ) ) ; msg . append ( "\nclazz.super.CS: " + clazz . getSuperclass ( ) . getProtectionDomain ( ) . getCodeSource ( ) ) ; msg . append ( "\nclazz.super.hash: " + System . identityHashCode ( clazz . getSuperclass ( ) ) ) ; ClassCastException cce = new ClassCastException ( msg . toString ( ) ) ; cce . initCause ( e ) ; throw cce ; } } return _factory ; }
<p>Get the system-wide AuthConfigFactory implementation.</p>

<p>If a non-null system-wide factory instance is defined at the time of the call,
for example, with setFactory, it will be returned. Otherwise, an attempt will be made to
construct an instance of the default AuthConfigFactory implementation class. The
fully qualified class name of the default factory implementation class is obtained
from the value of the DEFAULT_FACTORY_SECURITY_PROPERTY security property.  When an
instance of the default factory implementation class is successfully constructed by
this method, this method will set it as the system-wide factory instance.</p>

<p>The absolute pathname of the Java security properties file is JAVA_HOME/lib/security/java.security, where
JAVA_HOME refers to the directory where the JDK was installed. </p>

<p>When a SecurityManager is enabled, the getFactorySecurityPermission will be required to
call this method. If at the time of the call, a system-wide factory instance has not already been defined, then
the setFactorySecurityPermission will also be required.</p>

@return The non-null system-wide AuthConfigFactory instance set at the time of the
call, or if that value was null, the value of the system-wide factory
instance established by this method. This method returns null when the
system-wide factory was not defined when this method was called and no
default factory name was defined via the security property.

@throws SecurityException If the caller does not have permission to retrieve the factory,
or set it as the system-wide instance. Also thrown if an exception was thrown during the class loading,
or construction of the default AuthConfigFactory implementation class; in which case the
SecurityException will contain the root Exception as its cause.