directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1089062 - in /directory: apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/ shared/trunk/dsml/parser/src/main/java/org/apache/directory/sh...
Date Tue, 05 Apr 2011 14:37:39 GMT
Author: elecharny
Date: Tue Apr  5 14:37:39 2011
New Revision: 1089062

URL: http://svn.apache.org/viewvc?rev=1089062&view=rev
Log:
Removed the Attribute.getAll() method, it's a duplicate of the iterator() method.

Modified:
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/PasswordUtil.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ModifyRequestDsml.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Attribute.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultAttribute.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/DefaultAttributeTest.java

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java?rev=1089062&r1=1089061&r2=1089062&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java
(original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java
Tue Apr  5 14:37:39 2011
@@ -1079,26 +1079,26 @@ public class SchemaAwareEntryAttributeTe
      * Test method getAll()
      */
     @Test
-    public void testGetAll() throws LdapException
+    public void testIterator2() throws LdapException
     {
         Attribute attr = new DefaultAttribute( atEMail );
 
-        Iterator<Value<?>> iterator = attr.getAll();
+        Iterator<Value<?>> iterator = attr.iterator();
         assertFalse( iterator.hasNext() );
 
         attr.add( NULL_STRING_VALUE );
-        iterator = attr.getAll();
+        iterator = attr.iterator();
         assertTrue( iterator.hasNext() );
 
         Value<?> value = iterator.next();
         assertEquals( NULL_STRING_VALUE, value );
 
         attr.clear();
-        iterator = attr.getAll();
+        iterator = attr.iterator();
         assertFalse( iterator.hasNext() );
 
         attr.add( "a", "b", "c" );
-        iterator = attr.getAll();
+        iterator = attr.iterator();
         assertTrue( iterator.hasNext() );
         assertEquals( "a", iterator.next().getString() );
         assertEquals( "b", iterator.next().getString() );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1089062&r1=1089061&r2=1089062&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Tue Apr  5 14:37:39 2011
@@ -40,7 +40,6 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -88,11 +87,11 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.model.constants.LdapSecurityConstants;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.BinaryValue;
 import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
 import org.apache.directory.shared.ldap.model.entry.DefaultModification;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.model.entry.StringValue;
@@ -625,11 +624,9 @@ public class AuthenticationInterceptor e
                 Attribute pwdHistoryAt = entry.get( PWD_HISTORY_AT );
                 Set<PasswordHistory> pwdHistSet = new TreeSet<PasswordHistory>();
 
-                Iterator<Value<?>> itr = pwdHistoryAt.getAll();
-                while ( itr.hasNext() )
+                for ( Value<?> value : pwdHistoryAt  )
                 {
-                    Value<?> val = itr.next();
-                    PasswordHistory pwdh = new PasswordHistory( Strings.utf8ToString(val.getBytes())
);
+                    PasswordHistory pwdh = new PasswordHistory( Strings.utf8ToString( value.getBytes()
) );
 
                     boolean matched = Arrays.equals( newPassword, pwdh.getPassword() );
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/PasswordUtil.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/PasswordUtil.java?rev=1089062&r1=1089061&r2=1089062&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/PasswordUtil.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/PasswordUtil.java
Tue Apr  5 14:37:39 2011
@@ -28,7 +28,6 @@ import java.security.SecureRandom;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.directory.server.core.PasswordPolicyConfiguration;
@@ -37,8 +36,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.directory.shared.util.Base64;
 import org.apache.directory.shared.util.DateUtils;
-import org.apache.directory.shared.util.UnixCrypt;
 import org.apache.directory.shared.util.Strings;
+import org.apache.directory.shared.util.UnixCrypt;
 
 
 /**
@@ -526,22 +525,20 @@ public class PasswordUtil
             return;
         }
 
-        Iterator<Value<?>> itr = pwdFailTimeAt.getAll();
         interval *= 1000;
 
         long currentTime = System.currentTimeMillis();
         List<Value<?>> valList = new ArrayList<Value<?>>();
 
-        while ( itr.hasNext() )
+        for ( Value<?> value : pwdFailTimeAt )
         {
-            Value<?> val = itr.next();
-            String failureTime = val.getString();
+            String failureTime = value.getString();
             long time = DateUtils.getDate( failureTime ).getTime();
             time += interval;
 
             if ( currentTime > time )
             {
-                valList.add( val );
+                valList.add( value );
             }
         }
 

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ModifyRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ModifyRequestDsml.java?rev=1089062&r1=1089061&r2=1089062&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ModifyRequestDsml.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ModifyRequestDsml.java
Tue Apr  5 14:37:39 2011
@@ -21,13 +21,12 @@ package org.apache.directory.shared.dsml
 
 
 import java.util.Collection;
-import java.util.Iterator;
 
 import org.apache.directory.shared.dsmlv2.ParserUtils;
 import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
+import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
 import org.apache.directory.shared.ldap.model.entry.DefaultModification;
-import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.model.entry.Value;
@@ -162,12 +161,8 @@ public class ModifyRequestDsml 
             {
                 modElement.addAttribute( "name", modification.getAttribute().getId() );
 
-                Iterator<Value<?>> iterator = modification.getAttribute().getAll();
-
-                while ( iterator.hasNext() )
+                for ( Value<?> value : modification.getAttribute() )
                 {
-                    Value<?> value = iterator.next();
-
                     if ( value.getValue() != null )
                     {
                         if ( ParserUtils.needsBase64Encoding( value.getValue() ) )

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Attribute.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Attribute.java?rev=1089062&r1=1089061&r2=1089062&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Attribute.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Attribute.java
Tue Apr  5 14:37:39 2011
@@ -20,7 +20,6 @@ package org.apache.directory.shared.ldap
 
 
 import java.io.Externalizable;
-import java.util.Iterator;
 
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
@@ -247,18 +246,6 @@ public interface Attribute extends Itera
 
 
     /**
-     * Returns an iterator over all the attribute's values.
-     * <p>
-     * The effect on the returned enumeration of adding or removing values of
-     * the attribute is not specified.
-     * </p>
-     *
-     * @return an enumeration of all values of the attribute
-     */
-    Iterator<Value<?>> getAll();
-
-
-    /**
      * <p>
      * Get the byte[] value, if and only if the value is known to be Binary,
      * otherwise a InvalidAttributeValueException will be thrown

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultAttribute.java?rev=1089062&r1=1089061&r2=1089062&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultAttribute.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultAttribute.java
Tue Apr  5 14:37:39 2011
@@ -1461,15 +1461,6 @@ public class DefaultAttribute implements
     /**
      * {@inheritDoc}
      */
-    public Iterator<Value<?>> getAll()
-    {
-        return iterator();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
     public int size()
     {
         return values.size();

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/DefaultAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/DefaultAttributeTest.java?rev=1089062&r1=1089061&r2=1089062&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/DefaultAttributeTest.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/DefaultAttributeTest.java
Tue Apr  5 14:37:39 2011
@@ -897,26 +897,26 @@ public class DefaultAttributeTest
      * Test method getAll()
      */
     @Test
-    public void testGetAll() throws LdapException
+    public void testIterator2() throws LdapException
     {
         Attribute attr = new DefaultAttribute( "test" );
         
-        Iterator<Value<?>> iterator = attr.getAll(); 
+        Iterator<Value<?>> iterator = attr.iterator(); 
         assertFalse( iterator.hasNext() );
         
         attr.add( NULL_STRING_VALUE );
-        iterator = attr.getAll(); 
+        iterator = attr.iterator(); 
         assertTrue( iterator.hasNext() );
         
         Value<?> value = iterator.next();
         assertEquals( NULL_STRING_VALUE, value );
         
         attr.clear();
-        iterator = attr.getAll(); 
+        iterator = attr.iterator(); 
         assertFalse( iterator.hasNext() );
         
         attr.add(  "a", "b", "c" );
-        iterator = attr.getAll(); 
+        iterator = attr.iterator(); 
         assertTrue( iterator.hasNext() );
         assertEquals( "a", iterator.next().getString() );
         assertEquals( "b", iterator.next().getString() );



Mime
View raw message