From 9603069083bab9b05a47c485761bcbc9256a5c8b Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Sun, 26 Aug 2007 20:32:46 +0000
Subject: [PATCH] Update the traditional worker thread implementation so that the threads catch Throwable instead of Exception. This prevents them from exiting abnormally if they encounter something like an AssertionError, which could be thrown by unit tests or assert statements in the code if the associated condition isn't satisfied.
---
opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java b/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
index 28d6d5d..dadcbc9 100644
--- a/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
+++ b/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
@@ -174,37 +174,37 @@
}
}
}
- catch (Exception e)
+ catch (Throwable t)
{
if (debugEnabled())
{
TRACER.debugWarning(
"Uncaught exception in worker thread while processing " +
- "operation %s: %s", String.valueOf(operation), e);
+ "operation %s: %s", String.valueOf(operation), t);
- TRACER.debugCaught(DebugLogLevel.ERROR, e);
+ TRACER.debugCaught(DebugLogLevel.ERROR, t);
}
try
{
Message message = ERR_UNCAUGHT_WORKER_THREAD_EXCEPTION.
get(getName(), String.valueOf(operation),
- stackTraceToSingleLineString(e));
+ stackTraceToSingleLineString(t));
logError(message);
operation.setResultCode(DirectoryServer.getServerErrorResultCode());
operation.appendErrorMessage(message);
operation.getClientConnection().sendResponse(operation);
}
- catch (Exception e2)
+ catch (Throwable t2)
{
if (debugEnabled())
{
TRACER.debugWarning(
"Exception in worker thread while trying to log a " +
- "message about an uncaught exception %s: %s", e, e2);
+ "message about an uncaught exception %s: %s", t, t2);
- TRACER.debugCaught(DebugLogLevel.ERROR, e2);
+ TRACER.debugCaught(DebugLogLevel.ERROR, t2);
}
}
@@ -213,17 +213,16 @@
{
Message message = ERR_UNCAUGHT_WORKER_THREAD_EXCEPTION.get(getName(),
String.valueOf(operation),
- stackTraceToSingleLineString(e));
+ stackTraceToSingleLineString(t));
- operation.disconnectClient(
- DisconnectReason.SERVER_ERROR,
+ operation.disconnectClient(DisconnectReason.SERVER_ERROR,
true, message);
}
- catch (Exception e2)
+ catch (Throwable t2)
{
if (debugEnabled())
{
- TRACER.debugCaught(DebugLogLevel.ERROR, e2);
+ TRACER.debugCaught(DebugLogLevel.ERROR, t2);
}
}
}
--
Gitblit v1.10.0