harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r449889 - in /incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth: ./ module/
Date Tue, 26 Sep 2006 03:26:45 GMT
Author: ndbeyer
Date: Mon Sep 25 20:26:44 2006
New Revision: 449889

URL: http://svn.apache.org/viewvc?view=rev&rev=449889
Log:
Code cleanup
* Add braces around if/else statements
* Remove unused code
* Fix spelling errors
* Add annotations for Override
* Eliminate compiler warnings

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTDomainPrincipal.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTNumericCredential.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSid.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidDomainPrincipal.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidGroupPrincipal.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidPrimaryGroupPrincipal.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidUserPrincipal.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTUserPrincipal.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/module/NTLoginModule.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTDomainPrincipal.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTDomainPrincipal.java?view=diff&rev=449889&r1=449888&r2=449889
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTDomainPrincipal.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTDomainPrincipal.java
Mon Sep 25 20:26:44 2006
@@ -30,16 +30,13 @@
  */
 public class NTDomainPrincipal implements Principal, Serializable {
 
-    /**
-     * @serial
-     */
     private static final long serialVersionUID = 7574453578624887003L;
 
     // Domain name
     private String name;
 
     /**
-     * The sole ctor.
+     * Construct an instance with the given domain name.
      * @throws NullPointerException is name is null
      */
     public NTDomainPrincipal(String name) {
@@ -61,6 +58,7 @@
      * Two objects are considered equal if they both represent NTDomainPrincipal
      * and they have the same domain name.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == this) {
             return true;
@@ -74,6 +72,7 @@
     /**
      * Returns hashCode that value is equal to getName().hashCode();
      */
+    @Override
     public int hashCode() {
         return name.hashCode();
     }
@@ -81,6 +80,7 @@
     /**
      * Returns String representation of this object.
      */
+    @Override
     public String toString() {
         return "NTDomainPrincipal: " + name; //$NON-NLS-1$
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTNumericCredential.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTNumericCredential.java?view=diff&rev=449889&r1=449888&r2=449889
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTNumericCredential.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTNumericCredential.java
Mon Sep 25 20:26:44 2006
@@ -21,15 +21,14 @@
 package org.apache.harmony.auth;
 
 /** 
- * A Credential which stores information about impersonation token. 
+ * A credential which stores information about impersonation token. 
  */
 public class NTNumericCredential {
 
-    //
     private long token;
 
     /**
-     * The sole ctor.
+     * Constructs an instance wit the token passed.
      */
     public NTNumericCredential(long token) {
         this.token = token;
@@ -40,6 +39,7 @@
      * Two objects are considered equal if they both represent 
      * NTNumericCredential and they both have the same token value.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == this) {
             return true;
@@ -60,6 +60,7 @@
     /**
      * Returns hashCode for this object.
      */
+    @Override
     public int hashCode() {
         return (int) token;
     }
@@ -67,6 +68,7 @@
     /**
      * Returns String representation of this object.
      */
+    @Override
     public String toString() {
         return "NTNumericCredential: 0x" + Long.toHexString(token); //$NON-NLS-1$
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSid.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSid.java?view=diff&rev=449889&r1=449888&r2=449889
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSid.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSid.java
Mon Sep 25 20:26:44 2006
@@ -31,9 +31,6 @@
  */
 public class NTSid implements Serializable, Principal {
 
-    /**
-     * @serial
-     */
     private static final long serialVersionUID = 5589132933506948177L;
 
     // SID
@@ -68,8 +65,8 @@
      */
     public NTSid(String sid, String objName, String objDomain) {
         this(sid);
-        this.name = objName;
-        this.domain = objDomain;
+        name = objName;
+        domain = objDomain;
     }
 
     /**
@@ -103,6 +100,7 @@
     /**
      * Returns String representation of this object.
      */
+    @Override
     public String toString() {
         String str = getClass().getName();
         int dot = str.lastIndexOf('.');
@@ -117,6 +115,7 @@
      * Two objects are considered equal if they both represent 
      * NTSid and they both have the same sid value.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == this) {
             return true;
@@ -130,6 +129,7 @@
     /**
      * Returns hashCode for this object.
      */
+    @Override
     public int hashCode() {
         return sid.hashCode();
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidDomainPrincipal.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidDomainPrincipal.java?view=diff&rev=449889&r1=449888&r2=449889
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidDomainPrincipal.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidDomainPrincipal.java
Mon Sep 25 20:26:44 2006
@@ -24,10 +24,7 @@
  * A principal which holds information about NT domain.
  */
 public class NTSidDomainPrincipal extends NTSid {
-    
-    /**
-     * @serial
-     */
+
     private static final long serialVersionUID = -8278226353092135089L;
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidGroupPrincipal.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidGroupPrincipal.java?view=diff&rev=449889&r1=449888&r2=449889
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidGroupPrincipal.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidGroupPrincipal.java
Mon Sep 25 20:26:44 2006
@@ -24,10 +24,7 @@
  * A principal which holds information about user's group basing on group's sid.
  */
 public class NTSidGroupPrincipal extends NTSid {
-    
-    /**
-     * @serial
-     */
+
     private static final long serialVersionUID = -1181422254891703071L;
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidPrimaryGroupPrincipal.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidPrimaryGroupPrincipal.java?view=diff&rev=449889&r1=449888&r2=449889
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidPrimaryGroupPrincipal.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidPrimaryGroupPrincipal.java
Mon Sep 25 20:26:44 2006
@@ -25,10 +25,7 @@
  * group's sid.
  */
 public class NTSidPrimaryGroupPrincipal extends NTSid {
-    
-    /**
-     * @serial
-     */
+
     private static final long serialVersionUID = 1652712324814773197L;
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidUserPrincipal.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidUserPrincipal.java?view=diff&rev=449889&r1=449888&r2=449889
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidUserPrincipal.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTSidUserPrincipal.java
Mon Sep 25 20:26:44 2006
@@ -25,9 +25,6 @@
  */
 public class NTSidUserPrincipal extends NTSid {
 
-    /**
-     * @serial
-     */
     private static final long serialVersionUID = -76980455882379611L;
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTUserPrincipal.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTUserPrincipal.java?view=diff&rev=449889&r1=449888&r2=449889
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTUserPrincipal.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/NTUserPrincipal.java
Mon Sep 25 20:26:44 2006
@@ -30,9 +30,6 @@
  */
 public class NTUserPrincipal implements Serializable, Principal {
 
-    /**
-     * @serial
-     */
     private static final long serialVersionUID = 7585428904927483501L;
 
     // User name
@@ -59,6 +56,7 @@
     /**
      * Returns String representation of this object.
      */
+    @Override
     public String toString() {
         return "NTUserPrincipal: name=" + name; //$NON-NLS-1$
     }
@@ -68,6 +66,7 @@
      * Two objects are considered equal if they both represent NTUserPrincipal
      * and they have the same name.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj == this) {
             return true;
@@ -81,6 +80,7 @@
     /**
      * Returns hashCode for this object.
      */
+    @Override
     public int hashCode() {
         return name.hashCode();
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/module/NTLoginModule.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/module/NTLoginModule.java?view=diff&rev=449889&r1=449888&r2=449889
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/module/NTLoginModule.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/windows/org/apache/harmony/auth/module/NTLoginModule.java
Mon Sep 25 20:26:44 2006
@@ -20,6 +20,7 @@
  */
 package org.apache.harmony.auth.module;
 
+import java.security.Principal;
 import java.util.Map;
 import java.util.Set;
 
@@ -45,12 +46,8 @@
 
     private Subject subject;
 
-    private Map options;
+    private Map<String, ?> options;
 
-    //
-    private boolean debug;
-
-    //
     private NTSystem sys;
 
     private NTUserPrincipal user;
@@ -67,11 +64,8 @@
 
     private NTNumericCredential credential;
 
-    /** 
-     * @throws NullPointerException if either subject or options is null  
-     */
     public void initialize(Subject subject, CallbackHandler cbHandler,
-            Map sharedState, Map options) {
+            Map<String, ?> sharedState, Map<String, ?> options) {
         if (subject == null) {
             throw new NullPointerException(Messages.getString("auth.03")); //$NON-NLS-1$
         }
@@ -82,7 +76,6 @@
         //cbHandler - unused in this version
         //sharedState - unused
         this.options = options;
-        debug = "true".equalsIgnoreCase((String) options.get("debug")); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     /**
@@ -116,7 +109,7 @@
         if (subject.isReadOnly()) {
             throw new LoginException(Messages.getString("auth.05")); //$NON-NLS-1$
         }
-        Set ps = subject.getPrincipals();
+        Set<Principal> ps = subject.getPrincipals();
 
         if (!ps.contains(user)) {
             ps.add(user);
@@ -138,12 +131,12 @@
             ps.add(mainGroupSid);
         }
 
-        for (int i = 0; i < groupsSids.length; i++) {
-            if (!ps.contains(groupsSids[i])) {
-                ps.add(groupsSids[i]);
+        for (NTSidGroupPrincipal element : groupsSids) {
+            if (!ps.contains(element)) {
+                ps.add(element);
             }
         }
-        Set creds = subject.getPrivateCredentials();
+        Set<Object> creds = subject.getPrivateCredentials();
         if (!creds.contains(credential)) {
             creds.add(credential);
         }
@@ -181,7 +174,7 @@
         if (subject.isReadOnly()) {
             throw new LoginException(Messages.getString("auth.05")); //$NON-NLS-1$
         }
-        Set ps = subject.getPrincipals();
+        Set<Principal> ps = subject.getPrincipals();
 
         if (user != null) {
             ps.remove(user);
@@ -199,13 +192,13 @@
             ps.remove(mainGroupSid);
         }
         if (groupsSids != null) {
-            for (int i = 0; i < groupsSids.length; i++) {
-                ps.remove(groupsSids[i]);
+            for (NTSidGroupPrincipal element : groupsSids) {
+                ps.remove(element);
             }
         }
 
         if (credential != null) {
-            Set creds = subject.getPrivateCredentials();
+            Set<Object> creds = subject.getPrivateCredentials();
             creds.remove(credential);
         }
 



Mime
View raw message