src/share/classes/com/sun/jndi/ldap/LdapReferralContext.java

Print this page

        

*** 50,60 **** private LdapReferralException refEx = null; private boolean skipThisReferral = false; private int hopCount = 1; private NamingException previousEx = null; ! LdapReferralContext(LdapReferralException ex, Hashtable env, Control[] connCtls, Control[] reqCtls, String nextName, boolean skipThisReferral, int handleReferrals) throws NamingException { --- 50,62 ---- private LdapReferralException refEx = null; private boolean skipThisReferral = false; private int hopCount = 1; private NamingException previousEx = null; ! @SuppressWarnings("unchecked") // clone() ! LdapReferralContext(LdapReferralException ex, ! Hashtable<?,?> env, Control[] connCtls, Control[] reqCtls, String nextName, boolean skipThisReferral, int handleReferrals) throws NamingException {
*** 67,90 **** String referral; // Make copies of environment and connect controls for our own use. if (env != null) { ! env = (Hashtable) env.clone(); // Remove old connect controls from environment, unless we have new // ones that will override them anyway. if (connCtls == null) { env.remove(LdapCtx.BIND_CONTROLS); } } else if (connCtls != null) { ! env = new Hashtable(5); } if (connCtls != null) { Control[] copiedCtls = new Control[connCtls.length]; System.arraycopy(connCtls, 0, copiedCtls, 0, connCtls.length); // Add copied controls to environment, replacing any old ones. ! env.put(LdapCtx.BIND_CONTROLS, copiedCtls); } while (true) { try { referral = refEx.getNextReferral(); --- 69,93 ---- String referral; // Make copies of environment and connect controls for our own use. if (env != null) { ! env = (Hashtable<?,?>) env.clone(); // Remove old connect controls from environment, unless we have new // ones that will override them anyway. if (connCtls == null) { env.remove(LdapCtx.BIND_CONTROLS); } } else if (connCtls != null) { ! env = new Hashtable<String, Control[]>(5); } if (connCtls != null) { Control[] copiedCtls = new Control[connCtls.length]; System.arraycopy(connCtls, 0, copiedCtls, 0, connCtls.length); // Add copied controls to environment, replacing any old ones. ! ((Hashtable<? super String, ? super Control[]>)env) ! .put(LdapCtx.BIND_CONTROLS, copiedCtls); } while (true) { try { referral = refEx.getNextReferral();
*** 258,285 **** } refCtx.rename(overrideName(oldName), toName(refEx.getNewRdn())); } ! public NamingEnumeration list(String name) throws NamingException { return list(toName(name)); } ! public NamingEnumeration list(Name name) throws NamingException { if (skipThisReferral) { throw (NamingException) ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace()); } try { ! NamingEnumeration ne = null; if (urlScope != null && urlScope.equals("base")) { SearchControls cons = new SearchControls(); cons.setReturningObjFlag(true); cons.setSearchScope(SearchControls.OBJECT_SCOPE); ! ne = refCtx.search(overrideName(name), "(objectclass=*)", cons); } else { ne = refCtx.list(overrideName(name)); } --- 261,290 ---- } refCtx.rename(overrideName(oldName), toName(refEx.getNewRdn())); } ! public NamingEnumeration<NameClassPair> list(String name) throws NamingException { return list(toName(name)); } ! @SuppressWarnings("unchecked") ! public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { if (skipThisReferral) { throw (NamingException) ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace()); } try { ! NamingEnumeration<NameClassPair> ne = null; if (urlScope != null && urlScope.equals("base")) { SearchControls cons = new SearchControls(); cons.setReturningObjFlag(true); cons.setSearchScope(SearchControls.OBJECT_SCOPE); ! ne = (NamingEnumeration) ! refCtx.search(overrideName(name), "(objectclass=*)", cons); } else { ne = refCtx.list(overrideName(name)); }
*** 316,355 **** throw e; } } } ! public NamingEnumeration listBindings(String name) throws NamingException { return listBindings(toName(name)); } ! public NamingEnumeration listBindings(Name name) throws NamingException { if (skipThisReferral) { throw (NamingException) ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace()); } try { ! NamingEnumeration be = null; if (urlScope != null && urlScope.equals("base")) { SearchControls cons = new SearchControls(); cons.setReturningObjFlag(true); cons.setSearchScope(SearchControls.OBJECT_SCOPE); ! be = refCtx.search(overrideName(name), "(objectclass=*)", cons); } else { be = refCtx.listBindings(overrideName(name)); } refEx.setNameResolved(true); // append (referrals from) the exception that generated this // context to the new search results, so that referral processing // can continue ! ((ReferralEnumeration)be).appendUnprocessedReferrals(refEx); return (be); } catch (LdapReferralException e) { --- 321,364 ---- throw e; } } } ! public NamingEnumeration<Binding> listBindings(String name) throws ! NamingException { return listBindings(toName(name)); } ! @SuppressWarnings("unchecked") ! public NamingEnumeration<Binding> listBindings(Name name) throws ! NamingException { if (skipThisReferral) { throw (NamingException) ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace()); } try { ! NamingEnumeration<Binding> be = null; if (urlScope != null && urlScope.equals("base")) { SearchControls cons = new SearchControls(); cons.setReturningObjFlag(true); cons.setSearchScope(SearchControls.OBJECT_SCOPE); ! be = (NamingEnumeration)refCtx.search(overrideName(name), ! "(objectclass=*)", cons); } else { be = refCtx.listBindings(overrideName(name)); } refEx.setNameResolved(true); // append (referrals from) the exception that generated this // context to the new search results, so that referral processing // can continue ! ((ReferralEnumeration<Binding>)be).appendUnprocessedReferrals(refEx); return (be); } catch (LdapReferralException e) {
*** 460,470 **** } return refCtx.removeFromEnvironment(propName); } ! public Hashtable getEnvironment() throws NamingException { if (skipThisReferral) { throw (NamingException) ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace()); } --- 469,479 ---- } return refCtx.removeFromEnvironment(propName); } ! public Hashtable<?,?> getEnvironment() throws NamingException { if (skipThisReferral) { throw (NamingException) ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace()); }
*** 600,663 **** } return refCtx.getSchemaClassDefinition(overrideName(name)); } ! public NamingEnumeration search(String name, Attributes matchingAttributes) throws NamingException { return search(toName(name), SearchFilter.format(matchingAttributes), new SearchControls()); } ! public NamingEnumeration search(Name name, Attributes matchingAttributes) throws NamingException { return search(name, SearchFilter.format(matchingAttributes), new SearchControls()); } ! public NamingEnumeration search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { SearchControls cons = new SearchControls(); cons.setReturningAttributes(attributesToReturn); return search(toName(name), SearchFilter.format(matchingAttributes), cons); } ! public NamingEnumeration search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { SearchControls cons = new SearchControls(); cons.setReturningAttributes(attributesToReturn); return search(name, SearchFilter.format(matchingAttributes), cons); } ! public NamingEnumeration search(String name, String filter, SearchControls cons) throws NamingException { return search(toName(name), filter, cons); } ! public NamingEnumeration search(Name name, String filter, SearchControls cons) throws NamingException { if (skipThisReferral) { throw (NamingException) ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace()); } try { ! NamingEnumeration se = refCtx.search(overrideName(name), ! overrideFilter(filter), overrideAttributesAndScope(cons)); refEx.setNameResolved(true); // append (referrals from) the exception that generated this // context to the new search results, so that referral processing --- 609,674 ---- } return refCtx.getSchemaClassDefinition(overrideName(name)); } ! public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { return search(toName(name), SearchFilter.format(matchingAttributes), new SearchControls()); } ! public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException { return search(name, SearchFilter.format(matchingAttributes), new SearchControls()); } ! public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { SearchControls cons = new SearchControls(); cons.setReturningAttributes(attributesToReturn); return search(toName(name), SearchFilter.format(matchingAttributes), cons); } ! public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { SearchControls cons = new SearchControls(); cons.setReturningAttributes(attributesToReturn); return search(name, SearchFilter.format(matchingAttributes), cons); } ! public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) throws NamingException { return search(toName(name), filter, cons); } ! public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException { if (skipThisReferral) { throw (NamingException) ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace()); } try { ! NamingEnumeration<SearchResult> se = ! refCtx.search(overrideName(name), ! overrideFilter(filter), ! overrideAttributesAndScope(cons)); refEx.setNameResolved(true); // append (referrals from) the exception that generated this // context to the new search results, so that referral processing
*** 692,721 **** throw e; } } } ! public NamingEnumeration search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { return search(toName(name), filterExpr, filterArgs, cons); } ! public NamingEnumeration search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { if (skipThisReferral) { throw (NamingException) ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace()); } try { ! NamingEnumeration se; if (urlFilter != null) { se = refCtx.search(overrideName(name), urlFilter, overrideAttributesAndScope(cons)); } else { --- 703,732 ---- throw e; } } } ! public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { return search(toName(name), filterExpr, filterArgs, cons); } ! public NamingEnumeration<SearchResult> search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { if (skipThisReferral) { throw (NamingException) ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace()); } try { ! NamingEnumeration<SearchResult> se; if (urlFilter != null) { se = refCtx.search(overrideName(name), urlFilter, overrideAttributesAndScope(cons)); } else {