directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r473099 - in /directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search: ConnectorFilter.java SearchResultEntry.java SearchResultReference.java
Date Thu, 09 Nov 2006 22:21:26 GMT
Author: elecharny
Date: Thu Nov  9 14:21:25 2006
New Revision: 473099

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

Modified:
    directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ConnectorFilter.java
    directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
    directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultReference.java

Modified: directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ConnectorFilter.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ConnectorFilter.java?view=diff&rev=473099&r1=473098&r2=473099
==============================================================================
--- directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ConnectorFilter.java
(original)
+++ directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ConnectorFilter.java
Thu Nov  9 14:21:25 2006
@@ -25,7 +25,6 @@
 
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
-import java.util.Iterator;
 
 
 /**
@@ -40,7 +39,7 @@
     // ----------------------------------------------------------------------------
 
     /** The set of filters used by And/Or filters */
-    protected ArrayList filterSet;
+    protected ArrayList<Filter> filterSet;
 
     /** The filters length */
     protected transient int filtersLength;
@@ -70,7 +69,7 @@
 
         if ( filterSet == null )
         {
-            filterSet = new ArrayList();
+            filterSet = new ArrayList<Filter>();
         }
 
         filterSet.add( filter );
@@ -82,7 +81,7 @@
      * 
      * @return And array of filters
      */
-    public ArrayList getFilterSet()
+    public ArrayList<Filter> getFilterSet()
     {
         return filterSet;
     }
@@ -98,12 +97,8 @@
 
         if ( ( filterSet != null ) && ( filterSet.size() != 0 ) )
         {
-            Iterator filterIterator = filterSet.iterator();
-
-            while ( filterIterator.hasNext() )
+            for ( Filter filter:filterSet )
             {
-                Filter filter = ( Filter ) filterIterator.next();
-
                 connectorFilterLength += filter.computeLength();
             }
         }
@@ -131,12 +126,8 @@
         // encode each filter
         if ( ( filterSet != null ) && ( filterSet.size() != 0 ) )
         {
-            Iterator filterIterator = filterSet.iterator();
-
-            while ( filterIterator.hasNext() )
+            for ( Filter filter:filterSet )
             {
-                Filter filter = ( Filter ) filterIterator.next();
-
                 filter.encode( buffer );
             }
         }
@@ -158,14 +149,8 @@
 
         if ( ( filterSet != null ) && ( filterSet.size() != 0 ) )
         {
-
-            Iterator filterIterator = filterSet.iterator();
-
-            while ( filterIterator.hasNext() )
+            for ( Filter filter:filterSet )
             {
-
-                Filter filter = ( Filter ) filterIterator.next();
-
                 sb.append( '(' ).append( filter.toString() ).append( ')' );
             }
         }

Modified: directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java?view=diff&rev=473099&r1=473098&r2=473099
==============================================================================
--- directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
(original)
+++ directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
Thu Nov  9 14:21:25 2006
@@ -88,10 +88,10 @@
     private transient int attributesLength;
 
     /** The list of all attributes length */
-    private transient List attributeLength;
+    private transient List<Integer> attributeLength;
 
     /** The list of all vals length */
-    private transient List valsLength;
+    private transient List<Integer> valsLength;
 
 
     // ~ Constructors
@@ -240,8 +240,8 @@
         if ( ( partialAttributeList != null ) && ( partialAttributeList.size() !=
0 ) )
         {
             NamingEnumeration attributes = partialAttributeList.getAll();
-            attributeLength = new LinkedList();
-            valsLength = new LinkedList();
+            attributeLength = new LinkedList<Integer>();
+            valsLength = new LinkedList<Integer>();
 
             // Compute the attributes length
             while ( attributes.hasMoreElements() )
@@ -313,8 +313,8 @@
                 // add the attribute length to the attributes length
                 attributesLength += 1 + TLV.getNbBytes( localAttributeLength ) + localAttributeLength;
 
-                attributeLength.add( new Integer( localAttributeLength ) );
-                valsLength.add( new Integer( localValuesLength ) );
+                attributeLength.add( localAttributeLength );
+                valsLength.add( localValuesLength );
             }
         }
 

Modified: directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultReference.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultReference.java?view=diff&rev=473099&r1=473098&r2=473099
==============================================================================
--- directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultReference.java
(original)
+++ directory/branches/apacheds-schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultReference.java
Thu Nov  9 14:21:25 2006
@@ -30,7 +30,6 @@
 import java.nio.BufferOverflowException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
-import java.util.Iterator;
 
 
 /**
@@ -46,7 +45,7 @@
     // ----------------------------------------------------------------------------
 
     /** The set of LdapURLs */
-    private ArrayList searchResultReferences;
+    private ArrayList<LdapURL> searchResultReferences;
 
     /** The search result reference length */
     private transient int searchResultReferenceLength;
@@ -61,7 +60,7 @@
     public SearchResultReference()
     {
         super();
-        searchResultReferences = new ArrayList();
+        searchResultReferences = new ArrayList<LdapURL>();
     }
 
 
@@ -95,7 +94,7 @@
      * 
      * @return An ArrayList of SearchResultReferences
      */
-    public ArrayList getSearchResultReferences()
+    public ArrayList<LdapURL> getSearchResultReferences()
     {
         return searchResultReferences;
     }
@@ -123,12 +122,10 @@
     {
         searchResultReferenceLength = 0;
 
-        Iterator referencesIterator = searchResultReferences.iterator();
-
         // We may have more than one reference.
-        while ( referencesIterator.hasNext() )
+        for ( LdapURL reference:searchResultReferences )
         {
-            int ldapUrlLength = ( ( LdapURL ) referencesIterator.next() ).getNbBytes();
+            int ldapUrlLength = reference.getNbBytes();
             searchResultReferenceLength += 1 + TLV.getNbBytes( ldapUrlLength ) + ldapUrlLength;
         }
 
@@ -161,14 +158,9 @@
             buffer.put( LdapConstants.SEARCH_RESULT_REFERENCE_TAG );
             buffer.put( TLV.getBytes( searchResultReferenceLength ) );
 
-            // The references. We must at least have one reference
-            Iterator referencesIterator = searchResultReferences.iterator();
-
             // We may have more than one reference.
-            while ( referencesIterator.hasNext() )
+            for ( LdapURL reference:searchResultReferences )
             {
-                LdapURL reference = ( ( LdapURL ) referencesIterator.next() );
-
                 // Encode the reference
                 Value.encode( buffer, reference.getString() );
             }
@@ -202,12 +194,10 @@
         {
             sb.append( "        References\n" );
 
-            Iterator referencesIterator = searchResultReferences.iterator();
-
-            while ( referencesIterator.hasNext() )
+            for ( LdapURL reference:searchResultReferences )
             {
-                sb.append( "            '" ).append( ( ( LdapURL ) referencesIterator.next()
).toString() ).append(
-                    "'\n" );
+                sb.append( "            '" ).append( reference.toString() )
+                  .append( "'\n" );
             }
         }
 



Mime
View raw message