--- old/src/share/classes/com/sun/jndi/ldap/LdapNamingEnumeration.java 2011-07-27 17:20:28.002517800 -0700 +++ new/src/share/classes/com/sun/jndi/ldap/LdapNamingEnumeration.java 2011-07-27 17:20:27.364454000 -0700 @@ -27,25 +27,26 @@ import javax.naming.*; import javax.naming.directory.*; -import javax.naming.spi.*; import com.sun.jndi.toolkit.ctx.Continuation; import java.util.NoSuchElementException; import java.util.Vector; +import javax.naming.ldap.Control; import javax.naming.ldap.LdapName; /** * Basic enumeration for NameClassPair, Binding, and SearchResults. */ -class LdapNamingEnumeration implements NamingEnumeration, ReferralEnumeration { +class LdapNamingEnumeration implements NamingEnumeration, + ReferralEnumeration { protected Name listArg; private boolean cleaned = false; private LdapResult res; private LdapClient enumClnt; private Continuation cont; // used to fill in exceptions - private Vector entries = null; + private Vector entries = null; private int limit = 0; private int posn = 0; protected LdapCtx homeCtx; @@ -101,7 +102,7 @@ enumClnt = homeCtx.clnt; // remember } - public Object nextElement() { + public NameClassPair nextElement() { try { return next(); } catch (NamingException e) { @@ -146,11 +147,9 @@ // convert referrals into a chain of LdapReferralException homeCtx.processReturnCode(res, listArg); - } catch (LimitExceededException e) { + } catch (LimitExceededException | PartialResultException e) { setNamingException(e); - } catch (PartialResultException e) { - setNamingException(e); } } @@ -193,7 +192,7 @@ /* * Retrieve the next entry. */ - public Object next() throws NamingException { + public NameClassPair next() throws NamingException { if (!hasMoreCalled) { hasMore(); @@ -225,15 +224,9 @@ // try to process another referral return hasMoreReferrals(); - } catch (LdapReferralException e) { - cleanup(); - throw e; - - } catch (LimitExceededException e) { - cleanup(); - throw e; - - } catch (PartialResultException e) { + } catch (LdapReferralException | + LimitExceededException | + PartialResultException e) { cleanup(); throw e; @@ -249,7 +242,7 @@ /* * Retrieve the next entry. */ - private Object nextImpl() throws NamingException { + private NameClassPair nextImpl() throws NamingException { try { return nextAux(); } catch (NamingException e) { @@ -258,7 +251,7 @@ } } - private Object nextAux() throws NamingException { + private NameClassPair nextAux() throws NamingException { if (posn == limit) { getNextBatch(); // updates posn and limit } @@ -268,7 +261,7 @@ throw new NoSuchElementException("invalid enumeration handle"); } - LdapEntry result = (LdapEntry)entries.elementAt(posn++); + LdapEntry result = entries.elementAt(posn++); // gets and outputs DN from the entry return createItem(result.DN, result.attributes, result.respCtls); @@ -287,7 +280,7 @@ } protected NameClassPair createItem(String dn, Attributes attrs, - Vector respCtls) throws NamingException { + Vector respCtls) throws NamingException { Attribute attr; String className = null;