java.lang.NullPointerException

Oracle Community | 807573 | 9 years ago
  1. 0

    LDAP connectivity issue.

    Oracle Community | 9 years ago | 807573
    java.lang.NullPointerException
  2. 0

    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).

    JDK Bug System | 1 year ago | Webbug Group
    java.lang.NullPointerException
  3. 0

    NullPointerException on hasMore()

    Oracle Community | 2 decades ago | 843793
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    hasmore() throws nullpointer Exception

    Oracle Community | 1 decade ago | 843793
    java.lang.NullPointerException
  6. 0

    NullPointerException on hasMoreImpl() of LdapNamingEnumeration

    Oracle Community | 1 decade ago | 843793
    java.lang.NullPointerException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at com.sun.jndi.ldap.LdapNamingEnumeration.getNextBatch()
    2. Java RT
      LdapNamingEnumeration.hasMore
      1. com.sun.jndi.ldap.LdapNamingEnumeration.getNextBatch(LdapNamingEnumeration.java:108)
      2. com.sun.jndi.ldap.LdapNamingEnumeration.hasMore(LdapNamingEnumeration.java:162)
      2 frames
    3. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      2 frames
    4. com.iplanet.server
      NSServletRunner.Service
      1. com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:943)
      2. com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:494)
      2 frames