From f1f35f8507f5c7d49c3d010c8b1d0f3a72aeb3e2 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Fri, 26 Aug 2011 11:54:57 +0000
Subject: [PATCH] Minor fix: ensure that multiple results are not sent when an operation fails due to a run-time exception.
---
opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
index 5ef45d4..413144d 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/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);
+ }
}
}
--
Gitblit v1.10.0