directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r474101 - /directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnect.java
Date Mon, 13 Nov 2006 00:05:41 GMT
Author: elecharny
Date: Sun Nov 12 16:05:40 2006
New Revision: 474101

URL: http://svn.apache.org/viewvc?view=rev&rev=474101
Log:
Fixed warning by using generics

Modified:
    directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnect.java

Modified: directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnect.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnect.java?view=diff&rev=474101&r1=474100&r2=474101
==============================================================================
--- directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnect.java
(original)
+++ directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnect.java
Sun Nov 12 16:05:40 2006
@@ -22,7 +22,6 @@
 
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
@@ -50,7 +49,7 @@
 public class GracefulDisconnect extends GracefulAction
 {
     /** List of the alternate servers to use */
-    private List replicatedContexts;
+    private List<LdapURL> replicatedContexts;
 
     /** Length of the sequence */
     private transient int gracefulDisconnectSequenceLength;
@@ -70,7 +69,7 @@
         super( timeOffline, delay );
 
         // Two urls will be enough, generally
-        this.replicatedContexts = new ArrayList( 2 );
+        this.replicatedContexts = new ArrayList<LdapURL>( 2 );
     }
 
 
@@ -82,7 +81,7 @@
         super();
 
         // Two urls will be enough, generally
-        this.replicatedContexts = new ArrayList( 2 );
+        this.replicatedContexts = new ArrayList<LdapURL>( 2 );
     }
 
 
@@ -91,7 +90,7 @@
      * 
      * @return The list of replicated servers
      */
-    public List getReplicatedContexts()
+    public List<LdapURL> getReplicatedContexts()
     {
         return replicatedContexts;
     }
@@ -137,12 +136,10 @@
         {
             replicatedContextsLength = 0;
 
-            Iterator replicatedContextIterator = replicatedContexts.iterator();
-
             // We may have more than one reference.
-            while ( replicatedContextIterator.hasNext() )
+            for ( LdapURL replicatedContext:replicatedContexts )
             {
-                int ldapUrlLength = ( ( LdapURL ) replicatedContextIterator.next() ).getNbBytes();
+                int ldapUrlLength = replicatedContext.getNbBytes();
                 replicatedContextsLength += 1 + TLV.getNbBytes( ldapUrlLength ) + ldapUrlLength;
             }
 
@@ -186,13 +183,10 @@
             bb.put( UniversalTag.SEQUENCE_TAG );
             bb.put( TLV.getBytes( replicatedContextsLength ) );
 
-            Iterator replicatedContextIterator = replicatedContexts.iterator();
-
             // We may have more than one reference.
-            while ( replicatedContextIterator.hasNext() )
+            for ( LdapURL replicatedContext:replicatedContexts )
             {
-                LdapURL url = ( LdapURL ) replicatedContextIterator.next();
-                Value.encode( bb, url.getBytes() );
+                Value.encode( bb, replicatedContext.getBytes() );
             }
         }
 
@@ -213,14 +207,12 @@
 
         if ( replicatedContexts.size() != 0 )
         {
-            Iterator replicatedContextIterator = replicatedContexts.iterator();
             sb.append( "    Replicated contexts :" );
 
             // We may have more than one reference.
-            while ( replicatedContextIterator.hasNext() )
+            for ( LdapURL replicatedContext:replicatedContexts )
             {
-                LdapURL url = ( LdapURL ) replicatedContextIterator.next();
-                sb.append( "\n        " ).append( url.toString() );
+                sb.append( "\n        " ).append( replicatedContext.toString() );
             }
         }
 



Mime
View raw message