harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r451526 - in /incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth: login/ spi/
Date Sat, 30 Sep 2006 03:34:10 GMT
Author: ndbeyer
Date: Fri Sep 29 20:34:09 2006
New Revision: 451526

URL: http://svn.apache.org/viewvc?view=rev&rev=451526
Log:
Code cleanup -
* Add missing annotations
* Generification
* Add if/else braces
* Format comments

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountException.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountExpiredException.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountLockedException.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountNotFoundException.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AppConfigurationEntry.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/Configuration.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialException.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialExpiredException.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialNotFoundException.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/FailedLoginException.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/LoginContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/LoginException.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/spi/LoginModule.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountException.java?view=diff&rev=451526&r1=451525&r2=451526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountException.java
Fri Sep 29 20:34:09 2006
@@ -15,34 +15,16 @@
  *  limitations under the License.
  */
 
-/**
-* @author Maxim V. Makarov
-* @version $Revision$
-*/
-
 package javax.security.auth.login;
 
-/** 
- * @com.intel.drl.spec_ref 
- * 
- */
 public class AccountException extends LoginException {
 
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
     private static final long serialVersionUID = -2112878680072211787L;
-    
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
+
     public AccountException() {
         super();
     }
 
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
     public AccountException(String message) {
         super(message);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountExpiredException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountExpiredException.java?view=diff&rev=451526&r1=451525&r2=451526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountExpiredException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountExpiredException.java
Fri Sep 29 20:34:09 2006
@@ -15,36 +15,17 @@
  *  limitations under the License.
  */
 
-/**
-* @author Maxim V. Makarov
-* @version $Revision$
-*/
-
 package javax.security.auth.login;
 
-
-/** 
- * @com.intel.drl.spec_ref 
- * 
- */
 public class AccountExpiredException extends AccountException {
 
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
     private static final long serialVersionUID = -6064064890162661560L;
-    
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
+
     public AccountExpiredException() {
         super();
     }
 
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
     public AccountExpiredException(String message) {
         super(message);
     }
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountLockedException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountLockedException.java?view=diff&rev=451526&r1=451525&r2=451526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountLockedException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountLockedException.java
Fri Sep 29 20:34:09 2006
@@ -15,35 +15,16 @@
  *  limitations under the License.
  */
 
-/**
-* @author Maxim V. Makarov
-* @version $Revision$
-*/
-
 package javax.security.auth.login;
 
-
-/** 
- * @com.intel.drl.spec_ref 
- * 
- */
 public class AccountLockedException extends AccountException {
-    
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
+
     private static final long serialVersionUID = 8280345554014066334L;
 
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
     public AccountLockedException() {
         super();
     }
 
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
     public AccountLockedException(String message) {
         super(message);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountNotFoundException.java?view=diff&rev=451526&r1=451525&r2=451526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountNotFoundException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AccountNotFoundException.java
Fri Sep 29 20:34:09 2006
@@ -15,35 +15,16 @@
  *  limitations under the License.
  */
 
-/**
-* @author Maxim V. Makarov
-* @version $Revision$
-*/
-
 package javax.security.auth.login;
 
-
-/** 
- * @com.intel.drl.spec_ref 
- *
- */
 public class AccountNotFoundException extends AccountException {
 
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
     private static final long serialVersionUID = 1498349563916294614L;
-    
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
+
     public AccountNotFoundException() {
         super();
     }
 
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
     public AccountNotFoundException(String message) {
         super(message);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AppConfigurationEntry.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AppConfigurationEntry.java?view=diff&rev=451526&r1=451525&r2=451526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AppConfigurationEntry.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/AppConfigurationEntry.java
Fri Sep 29 20:34:09 2006
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Maxim V. Makarov
-* @version $Revision$
-*/
-
 package javax.security.auth.login;
 
 import java.util.Collections;
@@ -27,12 +22,8 @@
 
 import org.apache.harmony.auth.internal.nls.Messages;
 
-/** 
- * @com.intel.drl.spec_ref 
- */
 public class AppConfigurationEntry {
 
-
     // the login module options
     private final Map<String, ?> options;
 
@@ -42,16 +33,11 @@
     // the login module name 
     private final String loginModuleName;
 
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
     public AppConfigurationEntry(String loginModuleName,
-            AppConfigurationEntry.LoginModuleControlFlag controlFlag,
-            Map<String, ?> options) {
+            AppConfigurationEntry.LoginModuleControlFlag controlFlag, Map<String, ?>
options) {
 
         if (loginModuleName == null || loginModuleName.length() == 0) {
-            throw new IllegalArgumentException(
-                    Messages.getString("auth.26")); //$NON-NLS-1$
+            throw new IllegalArgumentException(Messages.getString("auth.26")); //$NON-NLS-1$
         }
 
         if (controlFlag == null) {
@@ -67,56 +53,32 @@
         this.options = Collections.unmodifiableMap(options);
     }
 
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
     public String getLoginModuleName() {
         return loginModuleName;
     }
 
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
     public LoginModuleControlFlag getControlFlag() {
         return controlFlag;
     }
 
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
     public Map<java.lang.String, ?> getOptions() {
         return options;
     }
 
-    /** 
-     * @com.intel.drl.spec_ref 
-     */
     public static class LoginModuleControlFlag {
 
         // the control flag
         private final String flag;
 
-        /** 
-         * @com.intel.drl.spec_ref 
-         */
         public static final LoginModuleControlFlag REQUIRED = new LoginModuleControlFlag(
                 "LoginModuleControlFlag: required"); //$NON-NLS-1$
 
-        /** 
-         * @com.intel.drl.spec_ref 
-         */
         public static final LoginModuleControlFlag REQUISITE = new LoginModuleControlFlag(
                 "LoginModuleControlFlag: requisite"); //$NON-NLS-1$
 
-        /** 
-         * @com.intel.drl.spec_ref 
-         */
         public static final LoginModuleControlFlag OPTIONAL = new LoginModuleControlFlag(
                 "LoginModuleControlFlag: optional"); //$NON-NLS-1$
 
-        /** 
-         * @com.intel.drl.spec_ref 
-         */
         public static final LoginModuleControlFlag SUFFICIENT = new LoginModuleControlFlag(
                 "LoginModuleControlFlag: sufficient"); //$NON-NLS-1$
 
@@ -125,12 +87,9 @@
             this.flag = flag;
         }
 
-        /** 
-         * @com.intel.drl.spec_ref 
-         */
+        @Override
         public String toString() {
             return flag;
         }
     }
-
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/Configuration.java?view=diff&rev=451526&r1=451525&r2=451526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/Configuration.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/Configuration.java
Fri Sep 29 20:34:09 2006
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Maxim V. Makarov
-* @version $Revision$
-*/
-
 package javax.security.auth.login;
 
 import java.security.AccessController;
@@ -27,35 +22,26 @@
 
 import org.apache.harmony.security.fortress.PolicyUtils;
 
-/**
- * @com.intel.drl.spec_ref
- * 
- */
 public abstract class Configuration {
-     
+
     // the current configuration 
     private static Configuration configuration;
-    
+
     // creates a AuthPermission object with a specify property
     private static final AuthPermission GET_LOGIN_CONFIGURATION = new AuthPermission(
-            "getLoginConfiguration");  //$NON-NLS-1$
+            "getLoginConfiguration"); //$NON-NLS-1$
 
     // creates a AuthPermission object with a specify property
     private static final AuthPermission SET_LOGIN_CONFIGURATION = new AuthPermission(
             "setLoginConfiguration"); //$NON-NLS-1$
-    
+
     // Key to security properties, defining default configuration provider.
     private static final String LOGIN_CONFIGURATION_PROVIDER = "login.configuration.provider";
//$NON-NLS-1$
-    
-    /**
-     * @com.intel.drl.spec_ref
-     */
+
     protected Configuration() {
+        super();
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public static Configuration getConfiguration() {
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
@@ -63,23 +49,23 @@
         }
         return getAccessibleConfiguration();
     }
-    
-    // Reads name of default configuration provider from security.properties,
-    // loads the class and instantiates the provider.<br> 
-    // In case of any exception, wraps it with SecurityException and throws
-    // further.
+
+    /**
+     * Reads name of default configuration provider from security.properties,
+     * loads the class and instantiates the provider.<br> In case of any
+     * exception, wraps it with SecurityException and throws further.
+     */
     private static final Configuration getDefaultProvider() {
-         return (Configuration) AccessController
-                .doPrivileged(new PolicyUtils.ProviderLoader(
-                        LOGIN_CONFIGURATION_PROVIDER, Configuration.class));
+        return AccessController.doPrivileged(new PolicyUtils.ProviderLoader<Configuration>(
+                LOGIN_CONFIGURATION_PROVIDER, Configuration.class));
     }
-    
+
     /**
      * Shortcut accessor for friendly classes, to skip security checks.
      * If active configuration was set to <code>null</code>, tries to load a
default 
      * provider, so this method never returns <code>null</code>. <br>
      * This method is synchronized with setConfiguration()
-     */     
+     */
     static Configuration getAccessibleConfiguration() {
         Configuration current = configuration;
         if (current == null) {
@@ -93,9 +79,6 @@
         return current;
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public static void setConfiguration(Configuration configuration) {
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
@@ -104,15 +87,8 @@
         Configuration.configuration = configuration;
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public abstract AppConfigurationEntry[] getAppConfigurationEntry(
-            String applicationName);
+    public abstract AppConfigurationEntry[] getAppConfigurationEntry(String applicationName);
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public abstract void refresh();
 
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialException.java?view=diff&rev=451526&r1=451525&r2=451526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialException.java
Fri Sep 29 20:34:09 2006
@@ -15,35 +15,16 @@
  *  limitations under the License.
  */
 
-/**
-* @author Maxim V. Makarov
-* @version $Revision$
-*/
-
 package javax.security.auth.login;
 
-
-/**
- * @com.intel.drl.spec_ref
- *
- */
 public class CredentialException extends LoginException {
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     private static final long serialVersionUID = -4772893876810601859L;
-    
-    /**
-     * @com.intel.drl.spec_ref
-     */
+
     public CredentialException() {
         super();
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public CredentialException(String message) {
         super(message);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialExpiredException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialExpiredException.java?view=diff&rev=451526&r1=451525&r2=451526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialExpiredException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialExpiredException.java
Fri Sep 29 20:34:09 2006
@@ -15,36 +15,18 @@
  *  limitations under the License.
  */
 
-/**
-* @author Maxim V. Makarov
-* @version $Revision$
-*/
-
 package javax.security.auth.login;
 
-/**
- * @com.intel.drl.spec_ref
- *
- */
 public class CredentialExpiredException extends CredentialException {
 
-    /**
-	 * @com.intel.drl.spec_ref
-	 */
     private static final long serialVersionUID = -5344739593859737937L;
-    
-    /**
-     * @com.intel.drl.spec_ref
-     */
+
     public CredentialExpiredException() {
         super();
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public CredentialExpiredException(String message) {
         super(message);
     }
 
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialNotFoundException.java?view=diff&rev=451526&r1=451525&r2=451526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialNotFoundException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/CredentialNotFoundException.java
Fri Sep 29 20:34:09 2006
@@ -15,34 +15,16 @@
  *  limitations under the License.
  */
 
-/**
-* @author Maxim V. Makarov
-* @version $Revision$
-*/
-
 package javax.security.auth.login;
 
-/**
- * @com.intel.drl.spec_ref
- *
- */
 public class CredentialNotFoundException extends CredentialException {
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     private static final long serialVersionUID = -7779934467214319475L;
-    
-    /**
-     * @com.intel.drl.spec_ref
-     */
+
     public CredentialNotFoundException() {
         super();
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public CredentialNotFoundException(String message) {
         super(message);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/FailedLoginException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/FailedLoginException.java?view=diff&rev=451526&r1=451525&r2=451526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/FailedLoginException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/FailedLoginException.java
Fri Sep 29 20:34:09 2006
@@ -15,34 +15,16 @@
  *  limitations under the License.
  */
 
-/**
-* @author Maxim V. Makarov
-* @version $Revision$
-*/
-
 package javax.security.auth.login;
 
-/**
- * @com.intel.drl.spec_ref
- *
- */
 public class FailedLoginException extends LoginException {
 
-    /**
-	 * @com.intel.drl.spec_ref
-	 */
     private static final long serialVersionUID = 802556922354616286L;
-    
-    /**
-     * @com.intel.drl.spec_ref
-     */
+
     public FailedLoginException() {
         super();
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public FailedLoginException(String message) {
         super(message);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/LoginContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/LoginContext.java?view=diff&rev=451526&r1=451525&r2=451526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/LoginContext.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/LoginContext.java
Fri Sep 29 20:34:09 2006
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Alexander V. Astapchuk, Stepan M. Mishura
-* @version $Revision$
-*/
-
 package javax.security.auth.login;
 
 import java.io.IOException;
@@ -43,18 +38,15 @@
 
 import org.apache.harmony.auth.internal.nls.Messages;
 
-/**
- * @com.intel.drl.spec_ref
- */
-
 public class LoginContext {
 
     private static final String DEFAULT_CALLBACK_HANDLER_PROPERTY = "auth.login.defaultCallbackHandler";
//$NON-NLS-1$
 
-    // Integer constants which serve as a replacement for 
-    // the corresponding LoginModuleControlFlag.* constants.
-    // These integers are used later as index in the arrays - see 
-    // loginImpl() and logoutImpl() methods
+    /*
+     * Integer constants which serve as a replacement for the corresponding
+     * LoginModuleControlFlag.* constants. These integers are used later as
+     * index in the arrays - see loginImpl() and logoutImpl() methods
+     */
     private static final int OPTIONAL = 0;
 
     private static final int REQUIRED = 1;
@@ -66,9 +58,10 @@
     // Subject to be used for this LoginContext's operations
     private Subject subject;
 
-    // Shows whether the subject 
-    // was specified by user (true) or 
-    // was created by this LoginContext itself (false).
+    /*
+     * Shows whether the subject was specified by user (true) or was created by
+     * this LoginContext itself (false).
+     */
     private boolean userProvidedSubject;
 
     // Shows whether we use installed or user-provided Configuration
@@ -77,16 +70,20 @@
     // An user's AccessControlContext, used when user specifies 
     private AccessControlContext userContext;
 
-    // Either a callback handler passed by the user or a wrapper for the 
-    // user's specified handler - see init() below.
+    /*
+     * Either a callback handler passed by the user or a wrapper for the user's
+     * specified handler - see init() below.
+     */
     private CallbackHandler callbackHandler;
 
-    // An array which keeps the instantiated and init()-ialized login 
-    // modules and their states
+    /*
+     * An array which keeps the instantiated and init()-ialized login modules
+     * and their states
+     */
     private Module[] modules;
 
     // Stores a shared state
-    private HashMap sharedState;
+    private Map<String, ?> sharedState;
 
     // A context class loader used to load [mainly] LoginModules
     private ClassLoader contextClassLoader;
@@ -94,39 +91,30 @@
     // Shows overall status - whether this LoginContext was successfully logged 
     private boolean loggedIn;
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public LoginContext(String name) throws LoginException {
+        super();
         init(name, null, null, null);
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public LoginContext(String name, CallbackHandler cbHandler)
-            throws LoginException {
+    public LoginContext(String name, CallbackHandler cbHandler) throws LoginException {
+        super();
         if (cbHandler == null) {
             throw new LoginException(Messages.getString("auth.34")); //$NON-NLS-1$
         }
         init(name, null, cbHandler, null);
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public LoginContext(String name, Subject subject) throws LoginException {
+        super();
         if (subject == null) {
             throw new LoginException(Messages.getString("auth.03")); //$NON-NLS-1$
         }
         init(name, subject, null, null);
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public LoginContext(String name, Subject subject, CallbackHandler cbHandler)
             throws LoginException {
+        super();
         if (subject == null) {
             throw new LoginException(Messages.getString("auth.03")); //$NON-NLS-1$
         }
@@ -136,22 +124,15 @@
         init(name, subject, cbHandler, null);
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
-    public LoginContext(String name, Subject subject,
-            CallbackHandler cbHandler, Configuration config)
-            throws LoginException {
+    public LoginContext(String name, Subject subject, CallbackHandler cbHandler,
+            Configuration config) throws LoginException {
+        super();
         init(name, subject, cbHandler, config);
     }
 
     // Does all the machinery needed for the initialization.
-    private void init(String name, Subject subject,
-            final CallbackHandler cbHandler, Configuration config)
-            throws LoginException {
-        //
-        //
-        //
+    private void init(String name, Subject subject, final CallbackHandler cbHandler,
+            Configuration config) throws LoginException {
         userProvidedSubject = (this.subject = subject) != null;
 
         //
@@ -170,16 +151,13 @@
         SecurityManager sm = System.getSecurityManager();
 
         if (sm != null && !userProvidedConfig) {
-            sm
-                    .checkPermission(new AuthPermission("createLoginContext." //$NON-NLS-1$
-                            + name));
+            sm.checkPermission(new AuthPermission("createLoginContext." + name));//$NON-NLS-1$
         }
 
         AppConfigurationEntry[] entries = config.getAppConfigurationEntry(name);
         if (entries == null) {
             if (sm != null && !userProvidedConfig) {
-                sm.checkPermission(new AuthPermission(
-                        "createLoginContext.other")); //$NON-NLS-1$
+                sm.checkPermission(new AuthPermission("createLoginContext.other")); //$NON-NLS-1$
             }
             entries = config.getAppConfigurationEntry("other"); //$NON-NLS-1$
             if (entries == null) {
@@ -195,16 +173,16 @@
         // Set CallbackHandler and this.contextClassLoader
         //
 
-        // as some of the operations to be executed (i.e. get*ClassLoader, 
-        // getProperty, class loading) are security-checked, then combine all 
-        // of them into a single doPrivileged() call.
-        //
+        /*
+         * as some of the operations to be executed (i.e. get*ClassLoader,
+         * getProperty, class loading) are security-checked, then combine all of
+         * them into a single doPrivileged() call.
+         */
         try {
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws Exception {
+            AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
+                public Void run() throws Exception {
                     // First, set the 'contextClassLoader'
-                    contextClassLoader = Thread.currentThread()
-                            .getContextClassLoader();
+                    contextClassLoader = Thread.currentThread().getContextClassLoader();
                     if (contextClassLoader == null) {
                         contextClassLoader = ClassLoader.getSystemClassLoader();
                     }
@@ -216,8 +194,7 @@
                         if (klassName == null || klassName.length() == 0) {
                             return null;
                         }
-                        Class klass = Class.forName(klassName, true,
-                                contextClassLoader);
+                        Class<?> klass = Class.forName(klassName, true, contextClassLoader);
                         callbackHandler = (CallbackHandler) klass.newInstance();
                     } else {
                         callbackHandler = cbHandler;
@@ -226,9 +203,8 @@
                 }
             });
         } catch (PrivilegedActionException ex) {
-            throw (LoginException) new LoginException(
-                    Messages.getString("auth.36")).initCause(ex //$NON-NLS-1$
-                    .getCause());
+            Throwable cause = ex.getCause();
+            throw (LoginException) new LoginException(Messages.getString("auth.36")).initCause(cause);//$NON-NLS-1$
         }
 
         if (userProvidedConfig) {
@@ -239,9 +215,6 @@
         }
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public Subject getSubject() {
         if (userProvidedSubject || loggedIn) {
             return subject;
@@ -249,12 +222,9 @@
         return null;
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public void login() throws LoginException {
-        PrivilegedExceptionAction action = new PrivilegedExceptionAction() {
-            public Object run() throws LoginException {
+        PrivilegedExceptionAction<Void> action = new PrivilegedExceptionAction<Void>()
{
+            public Void run() throws LoginException {
                 loginImpl();
                 return null;
             }
@@ -270,8 +240,10 @@
         }
     }
 
-    // The real implementation of login() method whose calls are wrapped into 
-    // appropriate doPrivileged calls in login().
+    /**
+     * The real implementation of login() method whose calls are wrapped into
+     * appropriate doPrivileged calls in login().
+     */
     private void loginImpl() throws LoginException {
         if (loggedIn) {
             return;
@@ -282,7 +254,7 @@
         }
 
         if (sharedState == null) {
-            sharedState = new HashMap();
+            sharedState = new HashMap<String, Object>();
         }
 
         // PHASE 1: Calling login()-s
@@ -291,16 +263,16 @@
         int[] logged = new int[4];
         int[] total = new int[4];
 
-        for (int i = 0; i < modules.length; i++) {
+        for (Module module : modules) {
             try {
                 // if a module fails during Class.forName(), then it breaks overall 
                 // attempt - see catch() below
-                modules[i].create(subject, callbackHandler, sharedState);
+                module.create(subject, callbackHandler, sharedState);
 
-                if (modules[i].module.login()) {
-                    ++total[modules[i].getFlag()];
-                    ++logged[modules[i].getFlag()];
-                    if (modules[i].getFlag() == SUFFICIENT) {
+                if (module.module.login()) {
+                    ++total[module.getFlag()];
+                    ++logged[module.getFlag()];
+                    if (module.getFlag() == SUFFICIENT) {
                         break;
                     }
                 }
@@ -308,21 +280,21 @@
                 if (firstProblem == null) {
                     firstProblem = ex;
                 }
-                if (modules[i].klass == null) {
-                    // an exception occured during class lookup - overall 
-                    // attempt must fail
-                    // a little trick: increase the REQUIRED's number - this 
-                    // will look like a failed REQUIRED module later, so overall 
-                    // attempt will fail
+                if (module.klass == null) {
+                    /*
+                     * an exception occurred during class lookup - overall
+                     * attempt must fail a little trick: increase the REQUIRED's
+                     * number - this will look like a failed REQUIRED module
+                     * later, so overall attempt will fail
+                     */
                     ++total[REQUIRED];
                     break;
-                } else {
-                    ++total[modules[i].getFlag()];
-                    // something happened after the class was loaded
-                    if (modules[i].getFlag() == REQUISITE) {
-                        // ... and no need to walk down anymore
-                        break;
-                    }
+                }
+                ++total[module.getFlag()];
+                // something happened after the class was loaded
+                if (module.getFlag() == REQUISITE) {
+                    // ... and no need to walk down anymore
+                    break;
                 }
             }
         }
@@ -331,16 +303,17 @@
         // Let's decide whether we have either overall success or a total failure
         boolean fail = true;
 
-        // Note: 'failed[xxx]!=0' is not enough to check.
-        // Use 'logged[xx] != total[xx]' instead.
-        // This is because some modules might not be counted as 'failed' if
-        // an exception occured during preload()/Class.forName()-ing.
-        // But, such modules still get counted in the total[]. 
+        /*
+         * Note: 'failed[xxx]!=0' is not enough to check.
+         * 
+         * Use 'logged[xx] != total[xx]' instead. This is because some modules
+         * might not be counted as 'failed' if an exception occurred during
+         * preload()/Class.forName()-ing. But, such modules still get counted in
+         * the total[].
+         */
 
-        //
         // if any REQ* module failed - then it's failure
-        if (logged[REQUIRED] != total[REQUIRED]
-                || logged[REQUISITE] != total[REQUISITE]) {
+        if (logged[REQUIRED] != total[REQUIRED] || logged[REQUISITE] != total[REQUISITE])
{
             // fail = true;
         } else {
             if (total[REQUIRED] == 0 && total[REQUISITE] == 0) {
@@ -360,12 +333,13 @@
         total[0] = total[1] = total[2] = total[3] = 0;
         if (!fail) {
             // PHASE 2: 
-            for (int i = 0; i < modules.length; i++) {
-                if (modules[i].klass != null) {
-                    ++total[modules[i].getFlag()];
+
+            for (Module module : modules) {
+                if (module.klass != null) {
+                    ++total[module.getFlag()];
                     try {
-                        modules[i].module.commit();
-                        ++commited[modules[i].getFlag()];
+                        module.module.commit();
+                        ++commited[module.getFlag()];
                     } catch (Throwable ex) {
                         if (firstProblem == null) {
                             firstProblem = ex;
@@ -377,13 +351,14 @@
 
         // need to decide once again
         fail = true;
-        if (commited[REQUIRED] != total[REQUIRED]
-                || commited[REQUISITE] != total[REQUISITE]) {
+        if (commited[REQUIRED] != total[REQUIRED] || commited[REQUISITE] != total[REQUISITE])
{
             //fail = true;
         } else {
             if (total[REQUIRED] == 0 && total[REQUISITE] == 0) {
-                // neither REQUIRED nor REQUISITE was configured.
-                // must have at least one SUFFICIENT or OPTIONAL
+                /*
+                 * neither REQUIRED nor REQUISITE was configured. must have at
+                 * least one SUFFICIENT or OPTIONAL
+                 */
                 if (commited[OPTIONAL] != 0 || commited[SUFFICIENT] != 0) {
                     fail = false;
                 } else {
@@ -395,10 +370,11 @@
         }
 
         if (fail) {
-            // either login() or commit() failed. aborting... 
-            for (int i = 0; i < modules.length; i++) {
+            // either login() or commit() failed. aborting...
+
+            for (Module module : modules) {
                 try {
-                    modules[i].module.abort();
+                    module.module.abort();
                 } catch ( /*LoginException*/Throwable ex) {
                     if (firstProblem == null) {
                         firstProblem = ex;
@@ -411,22 +387,15 @@
             }
             if (firstProblem instanceof LoginException) {
                 throw (LoginException) firstProblem;
-            } else {
-                throw (LoginException) new LoginException(
-                        Messages.getString("auth.37")).initCause(firstProblem); //$NON-NLS-1$
             }
-        } else {
-            loggedIn = true;
+            throw (LoginException) new LoginException(Messages.getString("auth.37")).initCause(firstProblem);
//$NON-NLS-1$
         }
-        // return silently - we are logged in
+        loggedIn = true;
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public void logout() throws LoginException {
-        PrivilegedExceptionAction action = new PrivilegedExceptionAction() {
-            public Object run() throws LoginException {
+        PrivilegedExceptionAction<Void> action = new PrivilegedExceptionAction<Void>()
{
+            public Void run() throws LoginException {
                 logoutImpl();
                 return null;
             }
@@ -442,8 +411,10 @@
         }
     }
 
-    // The real implementation of logout() method whose calls are wrapped into 
-    // appropriate doPrivileged calls in logout().
+    /**
+     * The real implementation of logout() method whose calls are wrapped into
+     * appropriate doPrivileged calls in logout().
+     */
     private void logoutImpl() throws LoginException {
         if (subject == null) {
             throw new LoginException(Messages.getString("auth.38")); //$NON-NLS-1$
@@ -451,9 +422,9 @@
         loggedIn = false;
         Throwable firstProblem = null;
         int total = 0;
-        for (int i = 0; i < modules.length; i++) {
+        for (Module module : modules) {
             try {
-                modules[i].module.logout();
+                module.module.logout();
                 ++total;
             } catch (Throwable ex) {
                 if (firstProblem == null) {
@@ -468,30 +439,31 @@
             }
             if (firstProblem instanceof LoginException) {
                 throw (LoginException) firstProblem;
-            } else {
-                throw (LoginException) new LoginException(
-                        Messages.getString("auth.37")).initCause(firstProblem); //$NON-NLS-1$
             }
+            throw (LoginException) new LoginException(Messages.getString("auth.37")).initCause(firstProblem);
//$NON-NLS-1$
         }
     }
 
-    // A class that servers as a wrapper for the CallbackHandler when we use 
-    // installed Configuration, but not a passed one. See API docs on the 
-    // LoginContext.<br>
-    // Simply invokes the given handler with the given AccessControlContext. 
+    /**
+     * <p>A class that servers as a wrapper for the CallbackHandler when we use
+     * installed Configuration, but not a passed one. See API docs on the
+     * LoginContext.</p>
+     * 
+     * <p>Simply invokes the given handler with the given AccessControlContext.</p>
+     */
     private class ContextedCallbackHandler implements CallbackHandler {
-        CallbackHandler hiddenHandlerRef;
+        private final CallbackHandler hiddenHandlerRef;
 
         ContextedCallbackHandler(CallbackHandler handler) {
+            super();
             this.hiddenHandlerRef = handler;
         }
 
         public void handle(final Callback[] callbacks) throws IOException,
                 UnsupportedCallbackException {
             try {
-                AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                    public Object run() throws IOException,
-                            UnsupportedCallbackException {
+                AccessController.doPrivileged(new PrivilegedExceptionAction<Void>()
{
+                    public Void run() throws IOException, UnsupportedCallbackException {
                         hiddenHandlerRef.handle(callbacks);
                         return null;
                     }
@@ -505,7 +477,9 @@
         }
     }
 
-    // A private class that stores an instantiated LoginModule.
+    /** 
+     * A private class that stores an instantiated LoginModule.
+     */
     private final class Module {
 
         // An initial info about the module to be used
@@ -514,11 +488,11 @@
         // A mapping of LoginModuleControlFlag onto a simple int constant
         int flag;
 
-        // The LoginModule intself 
+        // The LoginModule itself 
         LoginModule module;
 
         // A class of the module
-        Class klass;
+        Class<?> klass;
 
         Module(AppConfigurationEntry entry) {
             this.entry = entry;
@@ -539,17 +513,19 @@
             return flag;
         }
 
-        // Loads class of the LoginModule, instantiates it and then 
-        // calls initialize().
-        void create(Subject subject, CallbackHandler callbackHandler,
-                Map sharedState) throws LoginException {
+        /**
+         * Loads class of the LoginModule, instantiates it and then calls
+         * initialize().
+         */
+        void create(Subject subject, CallbackHandler callbackHandler, Map<String, ?>
sharedState)
+                throws LoginException {
             String klassName = entry.getLoginModuleName();
             if (klass == null) {
                 try {
                     klass = Class.forName(klassName, false, contextClassLoader);
                 } catch (ClassNotFoundException ex) {
-                    throw (LoginException) new LoginException(
-                            Messages.getString("auth.39", klassName)).initCause(ex); //$NON-NLS-1$
+                    throw (LoginException) new LoginException(Messages.getString(
+                            "auth.39", klassName)).initCause(ex); //$NON-NLS-1$
                 }
             }
 
@@ -557,17 +533,16 @@
                 try {
                     module = (LoginModule) klass.newInstance();
                 } catch (IllegalAccessException ex) {
-                    throw (LoginException) new LoginException(
-                            Messages.getString("auth.3A", klassName)) //$NON-NLS-1$
+                    throw (LoginException) new LoginException(Messages.getString(
+                            "auth.3A", klassName)) //$NON-NLS-1$
                             .initCause(ex);
                 } catch (InstantiationException ex) {
-                    throw (LoginException) new LoginException(
-                            Messages.getString("auth.3A", klassName)) //$NON-NLS-1$
+                    throw (LoginException) new LoginException(Messages.getString(
+                            "auth.3A", klassName)) //$NON-NLS-1$
                             .initCause(ex);
                 }
-                module.initialize(subject, callbackHandler, sharedState, entry
-                        .getOptions());
+                module.initialize(subject, callbackHandler, sharedState, entry.getOptions());
             }
         }
     }
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/LoginException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/LoginException.java?view=diff&rev=451526&r1=451525&r2=451526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/LoginException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/login/LoginException.java
Fri Sep 29 20:34:09 2006
@@ -15,38 +15,20 @@
  *  limitations under the License.
  */
 
-/**
-* @author Maxim V. Makarov
-* @version $Revision$
-*/
-
 package javax.security.auth.login;
 
 import java.security.GeneralSecurityException;
 
-/**
- * @com.intel.drl.spec_ref
- *
- */
 public class LoginException extends GeneralSecurityException {
 
-    /**
-	 * @com.intel.drl.spec_ref
-	 */
     private static final long serialVersionUID = -4679091624035232488L;
-    
-    /**
-     * @com.intel.drl.spec_ref
-     */
+
     public LoginException() {
         super();
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     public LoginException(String message) {
         super(message);
     }
 
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/spi/LoginModule.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/spi/LoginModule.java?view=diff&rev=451526&r1=451525&r2=451526
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/spi/LoginModule.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/spi/LoginModule.java
Fri Sep 29 20:34:09 2006
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Alexander V. Astapchuk
-* @version $Revision$
-*/
-
 package javax.security.auth.spi;
 
 import java.util.Map;
@@ -28,33 +23,16 @@
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.login.LoginException;
 
-/**
- * @com.intel.drl.spec_ref
- */
 public interface LoginModule {
-    /**
-     * @com.intel.drl.spec_ref
-     */
+
     void initialize(Subject subject, CallbackHandler callbackHandler,
             Map<String, ?> sharedState, Map<String, ?> options);
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     boolean login() throws LoginException;
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     boolean commit() throws LoginException;
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     boolean abort() throws LoginException;
 
-    /**
-     * @com.intel.drl.spec_ref
-     */
     boolean logout() throws LoginException;
-}
\ No newline at end of file
+}



Mime
View raw message