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

neil_a_wilson
04.41.2006 c8c1aceb026a3a793c01d6b7562bc8cb9e1ca139
Add a new set of methods to the Operation class that make it possible for
operations to provide information that will be available to the logger but
that should not be sent back to the client for some reason.

Also, update the Operation class to remove the possibility that the error log
buffer could be null.

OpenDS Issue Number: 558
1 files modified
88 ■■■■■ changed files
opends/src/server/org/opends/server/core/Operation.java 88 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/Operation.java
@@ -121,7 +121,12 @@
  // The result code for this operation.
  private ResultCode resultCode;
  // The error message for this operation.
  // Additional information that should be included in the log but not sent to
  // the client.
  private StringBuilder additionalLogMessage;
  // The error message for this operation that should be included in the log and
  // in the response to the client.
  private StringBuilder errorMessage;
@@ -150,6 +155,7 @@
    this.requestControls  = requestControls;
    resultCode                 = ResultCode.UNDEFINED;
    additionalLogMessage       = new StringBuilder();
    errorMessage               = new StringBuilder();
    attachments                = new HashMap<String,Object>();
    matchedDN                  = null;
@@ -342,11 +348,10 @@
  /**
   * Retrieves the error message for this operation.  If it is non-null, then
   * its contents may be altered by the caller.
   * Retrieves the error message for this operation.  Its contents may be
   * altered by the caller.
   *
   * @return  The error message for this operation, or <CODE>null</CODE> if the
   *          operation has not yet completed or does not have an error message.
   * @return  The error message for this operation.
   */
  public StringBuilder getErrorMessage()
  {
@@ -367,7 +372,14 @@
    assert debugEnter(CLASS_NAME, "setErrorMessage",
                      String.valueOf(errorMessage));
    this.errorMessage = errorMessage;
    if (errorMessage == null)
    {
      this.errorMessage = new StringBuilder();
    }
    else
    {
      this.errorMessage = errorMessage;
    }
  }
@@ -402,6 +414,70 @@
  /**
   * Retrieves the additional log message for this operation, which should be
   * written to the log but not included in the response to the client.  The
   * contents of this buffer may be altered by the caller.
   *
   * @return  The additional log message for this operation.
   */
  public StringBuilder getAdditionalLogMessage()
  {
    assert debugEnter(CLASS_NAME, "getAdditionalLogMessage");
    return additionalLogMessage;
  }
  /**
   * Specifies the additional log message for this operation, which should be
   * written to the log but not included in the response to the client.
   *
   * @param  additionalLogMessage  The additional log message for this
   *                               operation.
   */
  public void setAdditionalLogMessage(StringBuilder additionalLogMessage)
  {
    assert debugEnter(CLASS_NAME, "setAdditionalLogMessage",
                      String.valueOf(additionalLogMessage));
    if (additionalLogMessage == null)
    {
      this.additionalLogMessage = new StringBuilder();
    }
    else
    {
      this.additionalLogMessage = additionalLogMessage;
    }
  }
  /**
   * Appends the provided message to the additional log information for this
   * operation.
   *
   * @param  message  The message that should be appended to the additional log
   *                  information for this operation.
   */
  public void appendAdditionalLogMessage(String message)
  {
    assert debugEnter(CLASS_NAME, "appendAdditionalLogMessage",
                      String.valueOf(message));
    if (additionalLogMessage == null)
    {
      additionalLogMessage = new StringBuilder(message);
    }
    else
    {
      additionalLogMessage.append(message);
    }
  }
  /**
   * Retrieves the matched DN for this operation.
   *
   * @return  The matched DN for this operation, or <CODE>null</CODE> if the