mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
26.54.2011 f1f35f8507f5c7d49c3d010c8b1d0f3a72aeb3e2
Minor fix: ensure that multiple results are not sent when an operation fails due to a run-time exception.
2 files modified
19 ■■■■■ changed files
opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java 2 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java 17 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
@@ -182,6 +182,8 @@
                  stackTraceToSingleLineString(t));
          logError(message);
          // Ensure that the client receives some kind of result so that it does
          // not hang.
          operation.setResultCode(DirectoryServer.getServerErrorResultCode());
          operation.appendErrorMessage(message);
          operation.getClientConnection().sendResponse(operation);
opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2010 ForgeRock AS.
 *      Portions Copyright 2010-2011 ForgeRock AS.
 */
package org.opends.server.protocols.ldap;
@@ -673,12 +673,17 @@
                time);
    }
    removeOperationInProgress(operation.getMessageID());
    LDAPMessage message = operationToResponseLDAPMessage(operation);
    if (message != null)
    // Avoid sending the response if one has already been sent. This may happen
    // if operation processing encounters a run-time exception after sending the
    // response: the worker thread exception handling code will attempt to send
    // an error result to the client indicating that a problem occurred.
    if (removeOperationInProgress(operation.getMessageID()))
    {
      sendLDAPMessage(message);
      LDAPMessage message = operationToResponseLDAPMessage(operation);
      if (message != null)
      {
        sendLDAPMessage(message);
      }
    }
  }