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

neil_a_wilson
26.32.2007 9a9b02006553344eeed2f966538187edd5317210
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.
1 files modified
23 ■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java 23 ●●●● patch | view | raw | blame | history
opendj-sdk/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);
          }
        }
      }