--- old/src/share/classes/com/sun/jndi/ldap/LdapName.java 2011-07-27 17:20:21.838901500 -0700 +++ new/src/share/classes/com/sun/jndi/ldap/LdapName.java 2011-07-27 17:20:21.164834100 -0700 @@ -78,7 +78,7 @@ public final class LdapName implements Name { private transient String unparsed; // if non-null, the DN in unparsed form - private transient Vector rdns; // parsed name components + private transient Vector rdns; // parsed name components private transient boolean valuesCaseSensitive = false; /** @@ -97,9 +97,10 @@ * Constructs an LDAP name given its parsed components and, optionally * (if "name" is not null), the unparsed DN. */ - private LdapName(String name, Vector rdns) { + @SuppressWarnings("unchecked") + private LdapName(String name, Vector rdns) { unparsed = name; - this.rdns = (Vector)rdns.clone(); + this.rdns = (Vector)rdns.clone(); } /* @@ -107,9 +108,9 @@ * of "rdns" in the range [beg,end)) and, optionally * (if "name" is not null), the unparsed DN. */ - private LdapName(String name, Vector rdns, int beg, int end) { + private LdapName(String name, Vector rdns, int beg, int end) { unparsed = name; - this.rdns = new Vector(); + this.rdns = new Vector<>(); for (int i = beg; i < end; i++) { this.rdns.addElement(rdns.elementAt(i)); } @@ -130,7 +131,7 @@ if (i < rdns.size() - 1) { buf.append(','); } - Rdn rdn = (Rdn)rdns.elementAt(i); + Rdn rdn = rdns.elementAt(i); buf.append(rdn); } @@ -155,8 +156,8 @@ int minSize = Math.min(rdns.size(), that.rdns.size()); for (int i = 0 ; i < minSize; i++) { // Compare a single pair of RDNs. - Rdn rdn1 = (Rdn)rdns.elementAt(i); - Rdn rdn2 = (Rdn)that.rdns.elementAt(i); + Rdn rdn1 = rdns.elementAt(i); + Rdn rdn2 = that.rdns.elementAt(i); int diff = rdn1.compareTo(rdn2); if (diff != 0) { @@ -172,7 +173,7 @@ // For each RDN... for (int i = 0; i < rdns.size(); i++) { - Rdn rdn = (Rdn)rdns.elementAt(i); + Rdn rdn = rdns.elementAt(i); hash += rdn.hashCode(); } return hash; @@ -186,14 +187,14 @@ return rdns.isEmpty(); } - public Enumeration getAll() { - final Enumeration enum_ = rdns.elements(); + public Enumeration getAll() { + final Enumeration enum_ = rdns.elements(); - return new Enumeration () { + return new Enumeration() { public boolean hasMoreElements() { return enum_.hasMoreElements(); } - public Object nextElement() { + public String nextElement() { return enum_.nextElement().toString(); } }; @@ -254,7 +255,7 @@ Rdn rdn; if (n instanceof LdapName) { LdapName ln = (LdapName)n; - rdn = (Rdn)ln.rdns.elementAt(i - beg); + rdn = ln.rdns.elementAt(i - beg); } else { String rdnString = n.get(i - beg); try { @@ -286,9 +287,9 @@ rdns.insertElementAt(s.rdns.elementAt(i), pos++); } } else { - Enumeration comps = suffix.getAll(); + Enumeration comps = suffix.getAll(); while (comps.hasMoreElements()) { - DnParser p = new DnParser((String)comps.nextElement(), + DnParser p = new DnParser(comps.nextElement(), valuesCaseSensitive); rdns.insertElementAt(p.getRdn(), pos++); } @@ -406,9 +407,9 @@ /* * Parses the DN, returning a Vector of its RDNs. */ - Vector getDn() throws InvalidNameException { + Vector getDn() throws InvalidNameException { cur = 0; - Vector rdns = new Vector(len / 3 + 10); // leave room for growth + Vector rdns = new Vector<>(len / 3 + 10); // leave room for growth if (len == 0) { return rdns; @@ -595,7 +596,7 @@ * A vector of the TypeAndValue elements of this Rdn. * It is sorted to facilitate set operations. */ - private final Vector tvs = new Vector(); + private final Vector tvs = new Vector<>(); void add(TypeAndValue tv) { @@ -636,7 +637,7 @@ int minSize = Math.min(tvs.size(), that.tvs.size()); for (int i = 0; i < minSize; i++) { // Compare a single pair of type/value pairs. - TypeAndValue tv = (TypeAndValue)tvs.elementAt(i); + TypeAndValue tv = tvs.elementAt(i); int diff = tv.compareTo(that.tvs.elementAt(i)); if (diff != 0) { return diff; @@ -662,7 +663,7 @@ Attribute attr; for (int i = 0; i < tvs.size(); i++) { - tv = (TypeAndValue) tvs.elementAt(i); + tv = tvs.elementAt(i); if ((attr = attrs.get(tv.getType())) == null) { attrs.put(tv.getType(), tv.getUnescapedValue()); } else {