Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

LDAP JDK LDAPReferralException .toString throws exception?

8 views
Skip to first unread message

ohaya

unread,
Nov 16, 2007, 7:33:52 AM11/16/07
to
Hi,

We have some older code that uses the Sun LDAP JDK (ldapjdk.jar) which,
when run under JRE 1.42, works fine. In this code, we do a search() in
a try, with a catch, and in the catch, we do some output
(System.out.println()). This looks something like:

try {
.
.
ld.search(....);
.
.
} catch (LDAPReferralException e) {
System.out.println("xxxx");
System.out.println("xxx" + e.toString());
.
}


However, when we run this code under JRE 1.50_05, the code inside the
catch is throwing what appears to be a Nullpointerexception at any line
that is using e.toString().

I don't think the LDAPReferralException object itself is null, because
some other methods on the object (e.g., e.getMessage()) seem to work.

We've tried a number of things, including re-compiling the code under
JDK 1.50_05, but still see the same problem.

The only workaround for this that we've found so far is to either:

- Re-code to not use/output e.toString(), or
- Put the System.out.println(...e.toString()) inside another try (i.e.,
putting a try inside the catch).

Again, this problem only appears if the code is run under JRE 1.50. It
works fine when run under JRE 1.42_xx.

We can do the re-code, but I'm curious if anyone else has run across this?

Thanks,
Jim

ohaya

unread,
Nov 16, 2007, 8:43:42 AM11/16/07
to


Hi,

I've made a smaller standalone Java app that has this same code plus
some addition printlns in the catch, and the following is the stack
trace that I'm getting:

In getPwdLastSet(): ** ERROR **: LDAP search for 'pwdLastSet' failed ...
In getPwdLastSet(): ** ERROR **:
LDAPReferralException.getLDAPErrorMessage(): [
Referral:
ldap://whatever.com/CN=Configuration,DC=whatever,DC=com]
In getPwdLastSet(): ** ERROR **: This MAY BLOW UP NOW...
Exception in thread "main" java.lang.NullPointerException
at
netscape.ldap.LDAPReferralException.toString(LDAPReferralException.ja
va:163)
at
TestLDAPReferralException.getPwdLastSet(TestLDAPReferralException.jav
a:163)
at
TestLDAPReferralException.main(TestLDAPReferralException.java:221)

Jim

ohaya

unread,
Nov 15, 2007, 10:26:19 AM11/15/07
to

Hi,

My apologies. I just noticed that the system clock on my system had the
wrong date, so my earlier posts were dated 11/16/07 :(....

Jim

0 new messages