directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r491847 - in /directory/trunks/apacheds/core/src: main/java/org/apache/directory/server/core/authn/ test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/
Date Tue, 02 Jan 2007 16:50:29 GMT
Author: elecharny
Date: Tue Jan  2 08:50:28 2007
New Revision: 491847

URL: http://svn.apache.org/viewvc?view=rev&rev=491847
Log:
Replaced a call to ArrayUtils.isEquals by a call ti the util.Arrays.equals() method, which
is 2.5 times faster for typed comparizons

Modified:
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
    directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributeSerializerTest.java
    directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributesSerializerTest.java

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?view=diff&rev=491847&r1=491846&r2=491847
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
(original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
Tue Jan  2 08:50:28 2007
@@ -22,6 +22,7 @@
 
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
@@ -113,7 +114,7 @@
         byte[] userPassword = null;
         if ( credentialCache.containsKey( principalDn.getNormName() ) )
         {
-            userPassword = ( byte[] ) credentialCache.get( principalDn.getNormName() );
+            userPassword = credentialCache.get( principalDn.getNormName() );
         }
         else
         {
@@ -132,7 +133,7 @@
                 String algorithm = this.getAlgorithmForHashedPassword( userPassword );
                 String digestedCredits = this.createDigestedPassword( algorithm, creds );
 
-                credentialsMatch = ArrayUtils.isEquals( StringTools.getBytesUtf8( digestedCredits
), userPassword );
+                credentialsMatch = Arrays.equals( StringTools.getBytesUtf8( digestedCredits
), userPassword );
             }
             catch ( NoSuchAlgorithmException nsae )
             {
@@ -146,7 +147,7 @@
         else
         {
             // password is not stored one-way encrypted
-            credentialsMatch = ArrayUtils.isEquals( creds, userPassword );
+            credentialsMatch = Arrays.equals( (byte[])creds, userPassword );
         }
 
         if ( credentialsMatch )

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributeSerializerTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributeSerializerTest.java?view=diff&rev=491847&r1=491846&r2=491847
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributeSerializerTest.java
(original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributeSerializerTest.java
Tue Jan  2 08:50:28 2007
@@ -218,8 +218,8 @@
         
         byte[] serialized = serializer.serialize( attr );
         Attribute deserialized = ( Attribute ) serializer.deserialize( serialized );
-        ArrayUtils.isEquals( ba0, ( byte[] ) deserialized.get() );
-        ArrayUtils.isEquals( ba1, ( byte[] ) deserialized.get( 1 ) );
+        ArrayUtils.isEquals( ba0, deserialized.get() );
+        ArrayUtils.isEquals( ba1, deserialized.get( 1 ) );
     }
     
     

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributesSerializerTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributesSerializerTest.java?view=diff&rev=491847&r1=491846&r2=491847
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributesSerializerTest.java
(original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributesSerializerTest.java
Tue Jan  2 08:50:28 2007
@@ -68,8 +68,8 @@
         assertEquals( "anything over here!", attrDeserialized0.get( 2 ) );
         
         LockableAttributeImpl attrDeserialized1 = ( LockableAttributeImpl ) deserialized.get(
"attr1" );
-        ArrayUtils.isEquals( ba0, ( byte[] ) attrDeserialized1.get() );
-        ArrayUtils.isEquals( ba1, ( byte[] ) attrDeserialized1.get( 1 ) );
+        ArrayUtils.isEquals( ba0, attrDeserialized1.get() );
+        ArrayUtils.isEquals( ba1, attrDeserialized1.get( 1 ) );
     }
     
     



Mime
View raw message