Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8273402

Use derived NamingExceptions in com.sun.jndi.ldap.Connection#readReply

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b15
    • CPU:
      generic
    • OS:
      generic

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Any OS, Java 8, 11

      A DESCRIPTION OF THE PROBLEM :
      When an LDAP operation fails for technical reasons (read timeout, broken connection) the aforemetioned class will unfortunately use a general NamingException to signal this to client code. The client code has no way to distinguish this from other NamingExceptions. The CommunicationException has been especially designed for this:
        * This exception is thrown when the client is
        * unable to communicate with the directory or naming service.
        * The inability to communicate with the service might be a result
        * of many factors, such as network partitioning, hardware or interface problems,
        * failures on either the client or server side.
        * This exception is meant to be used to capture such communication problems.

      The RFE is to turn:
              if (result == null) {
                  throw new NamingException(String.format(TIMEOUT_MSG_FMT, millis));
              }
              // Unexpected EOF can be caused by connection closure or cancellation
              if (result == EOF) {
                  throw new NamingException(CLOSE_MSG);
              }
      into
              if (result == null) {
                  throw new CommunicationException(String.format(TIMEOUT_MSG_FMT, millis));
              }
              // Unexpected EOF can be caused by connection closure or cancellation
              if (result == EOF) {
                  throw new CommunicationException(CLOSE_MSG);
              }

      which will give the client a change to recover from by retry the operation because it did not fail for LDAP reasons.

      This has been reported with Apache Tomcat: https://www.mail-archive.com/users@tomcat.apache.org/msg138297.html


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              aefimov Aleksej Efimov
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: