RFR: 8288895: LdapContext doesn't honor set referrals limit

Daniel Fuchs dfuchs at openjdk.org
Mon Jun 27 15:01:44 UTC 2022


On Thu, 23 Jun 2022 08:20:31 GMT, rmartinc <duke at openjdk.org> wrote:

> Fixes [JDK-8288895](https://bugs.openjdk.org/browse/JDK-8288895).
> 
> Any `LimitExceededException` now quits the referral loop.
> 
> Added class `ReferralLimitSearchTest`. It is a simple jtreg test which checks that `java.naming.ldap.referral.limit` is really enforced. The dummy ldap server always returns a referral for any search query. If the number of searches exceeds the limit, it throws an `IOException` and the test fails.
> 
> 
> make test TEST=jtreg:jdk/com/sun/jndi/ldap/ReferralLimitSearchTest.java

Changes requested by dfuchs (Reviewer).

src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java line 338:

> 336:                         errEx = re.getNamingException();
> 337:                         break;
> 338:                     } else if (errEx == null) {

Could we set up a local variable here to avoid calling re.getNamingException() more than once?
e.g. something like:


var cause = re.getNamingException();
if (cause instanceof ...) {


then use `cause` throughout.

-------------

PR: https://git.openjdk.org/jdk/pull/9256


More information about the core-libs-dev mailing list