src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java

Print this page

        

@@ -201,15 +201,15 @@
 
    /**
      * A class for dealing with compound filters ("and" & "or" filters).
      */
     final class CompoundFilter implements StringFilter {
-        private Vector  subFilters;
+        private Vector<StringFilter>  subFilters;
         private boolean polarity;
 
         CompoundFilter(boolean polarity) {
-            subFilters = new Vector();
+            subFilters = new Vector<>();
             this.polarity = polarity;
         }
 
         public void parse() throws InvalidSearchFilterException {
             SearchFilter.this.consumeChar(); // consume the "&"

@@ -221,11 +221,11 @@
             }
         }
 
         public boolean check(Attributes targetAttrs) throws NamingException {
             for(int i = 0; i<subFilters.size(); i++) {
-                StringFilter filter = (StringFilter)subFilters.elementAt(i);
+                StringFilter filter = subFilters.elementAt(i);
                 if(filter.check(targetAttrs) != this.polarity) {
                     return !polarity;
                 }
             }
             return polarity;

@@ -328,11 +328,11 @@
             if(debug) {System.out.println("AtomicFilter: " + attrID + "=" +
                                           value);}
         }
 
         public boolean check(Attributes targetAttrs) {
-            Enumeration candidates;
+            Enumeration<?> candidates;
 
             try {
                 Attribute attr = targetAttrs.get(attrID);
                 if(attr == null) {
                     return false;

@@ -439,17 +439,18 @@
         }
 
         String answer;
         answer = "(& ";
         Attribute attr;
-        for (NamingEnumeration e = attrs.getAll(); e.hasMore(); ) {
-            attr = (Attribute)e.next();
+        for (NamingEnumeration<? extends Attribute> e = attrs.getAll();
+             e.hasMore(); ) {
+            attr = e.next();
             if (attr.size() == 0 || (attr.size() == 1 && attr.get() == null)) {
                 // only checking presence of attribute
                 answer += "(" + attr.getID() + "=" + "*)";
             } else {
-                for (NamingEnumeration ve = attr.getAll();
+                for (NamingEnumeration<?> ve = attr.getAll();
                      ve.hasMore();
                         ) {
                     String val = getEncodedStringRep(ve.next());
                     if (val != null) {
                         answer += "(" + attr.getID() + "=" + val + ")";