java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • LDAP connectivity issue.
    via by 807573,
  • FULL PRODUCT VERSION : java version "1.7.0_72" Java(TM) SE Runtime Environment (build 1.7.0_72-b14) Java HotSpot(TM) Server VM (build 24.72-b04, mixed mode) ADDITIONAL OS VERSION INFORMATION : SunOS n3 5.10 Generic_150401-18 i86pc i386 i86pc A DESCRIPTION OF THE PROBLEM : When an LDAP response is received with status of LdapClient.LDAP_REFERRAL but no referrals are present (and handleReferrals is set to LDAP_REF_THROW), the following exception is received: java.lang.NullPointerException at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2930) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2840) at com.sun.jndi.ldap.LdapNamingEnumeration.getNextBatch(LdapNamingEnumeration.java:147) at com.sun.jndi.ldap.LdapNamingEnumeration.hasMoreImpl(LdapNamingEnumeration.java:216) at com.sun.jndi.ldap.LdapNamingEnumeration.hasMore(LdapNamingEnumeration.java:189) Looking at the source for LdapCtx, res.referrals.elementAt(0) is invoked without first testing that res.referrals is not null. Yes, this is technically an invalid LDAP message, but invalid messages should not result in null pointer exceptions in the stack. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Here is our code snippet that calls into search(): NamingEnumeration<SearchResult> enumeration = null; try { setInterruptible(true); scheduleInterruptTimerTask(timer, interruptTimerTask, interruptTimeLimit); enumeration = ldapContext.search(ldapSearchArguments.getDn(), ldapSearchArguments.getFilter(), searchControls); SearchResult searchResult; while (enumeration.hasMore()) { searchResult = enumeration.next(); returnedAttributes.add(searchResult.getAttributes()); } } finally { cancelInterruptTimerTaskAndSetUnInterruptible(interruptTimerTask); closeEnumeration(enumeration); } As mentioned in the Description, the LDAP response has a status of LdapClient.LDAP_REFERRAL but no referrals are present in the message. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The stack should be throwing some kind of NamingException rather than a null pointer exception. ACTUAL - See stack trace in Description. ERROR MESSAGES/STACK TRACES THAT OCCUR : See stack trace in Description. REPRODUCIBILITY : This bug can be reproduced always. CUSTOMER SUBMITTED WORKAROUND : We currently have to ignore referrals until this bug is fixed (i.e. handleReferrals is set to LDAP_REF_IGNORE).
    via by Webbug Group,
  • NullPointerException on hasMore()
    via by 843793,
    • java.lang.NullPointerException at com.sun.jndi.ldap.LdapNamingEnumeration.getNextBatch(LdapNamingEnumeration.java:108) at com.sun.jndi.ldap.LdapNamingEnumeration.hasMore(LdapNamingEnumeration.java:162) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:943) at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:494)
    No Bugmate found.