Re: LDAP JDK LDAPReferralException .toString throws exception?

ohaya <[email protected]>
Newsgroups gmane.comp.mozilla.devel.directory
Message-ID <[email protected]>
ohaya wrote:
> 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


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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.