directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1444153 - in /directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption: KerberosKeyFactory.java RandomKeyFactory.java
Date Fri, 08 Feb 2013 17:20:38 GMT
Author: elecharny
Date: Fri Feb  8 17:20:36 2013
New Revision: 1444153

URL: http://svn.apache.org/r1444153
Log:
Used for-each instead of an Iterator

Modified:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactory.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactory.java

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactory.java?rev=1444153&r1=1444152&r2=1444153&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactory.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactory.java
Fri Feb  8 17:20:36 2013
@@ -23,7 +23,6 @@ package org.apache.directory.server.kerb
 
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -91,10 +90,8 @@ public class KerberosKeyFactory
     {
         Map<EncryptionType, EncryptionKey> kerberosKeys = new HashMap<EncryptionType,
EncryptionKey>();
 
-        Iterator<EncryptionType> it = ciphers.iterator();
-        while ( it.hasNext() )
+        for ( EncryptionType encryptionType : ciphers )
         {
-            EncryptionType encryptionType = it.next();
             try
             {
                 kerberosKeys.put( encryptionType, string2Key( principalName, passPhrase,
encryptionType ) );
@@ -109,15 +106,16 @@ public class KerberosKeyFactory
 
         return kerberosKeys;
     }
-    
-    
+
+
     public static EncryptionKey string2Key( String principalName, String passPhrase, EncryptionType
encryptionType )
     {
         KerberosPrincipal principal = new KerberosPrincipal( principalName );
-        KerberosKey kerberosKey = new KerberosKey( principal, passPhrase.toCharArray(), KerberosUtils.getAlgoNameFromEncType(
encryptionType ) );
+        KerberosKey kerberosKey = new KerberosKey( principal, passPhrase.toCharArray(),
+            KerberosUtils.getAlgoNameFromEncType( encryptionType ) );
         EncryptionKey encryptionKey = new EncryptionKey( encryptionType, kerberosKey.getEncoded(),
kerberosKey
             .getVersionNumber() );
-        
+
         return encryptionKey;
     }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactory.java?rev=1444153&r1=1444152&r2=1444153&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactory.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactory.java
Fri Feb  8 17:20:36 2013
@@ -23,7 +23,6 @@ package org.apache.directory.server.kerb
 import java.security.NoSuchAlgorithmException;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -31,10 +30,10 @@ import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
 
 import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.shared.kerberos.exceptions.KerberosException;
 import org.apache.directory.shared.kerberos.codec.types.EncryptionType;
 import org.apache.directory.shared.kerberos.components.EncryptionKey;
 import org.apache.directory.shared.kerberos.exceptions.ErrorType;
+import org.apache.directory.shared.kerberos.exceptions.KerberosException;
 
 
 /**
@@ -87,11 +86,9 @@ public class RandomKeyFactory
     {
         Map<EncryptionType, EncryptionKey> map = new HashMap<EncryptionType, EncryptionKey>();
 
-        Iterator<EncryptionType> it = ciphers.iterator();
-        while ( it.hasNext() )
+        for ( EncryptionType encryptionType : ciphers )
         {
-            EncryptionType type = it.next();
-            map.put( type, getRandomKey( type ) );
+            map.put( encryptionType, getRandomKey( encryptionType ) );
         }
 
         return map;



Mime
View raw message