CPD Results

The following document contains the results of PMD's CPD 4.2.5.

Duplications

File Line
de\smartics\exceptions\AbstractCoreException.java 109
de\smartics\exceptions\AbstractCoreRuntimeException.java 112
  protected AbstractCoreRuntimeException(final String message,
      final Throwable cause, final Code code) throws NullPointerException
  {
    super(message, Helper.provideException(cause));
    this.info = new ExceptionInfo(cause, code);
  }

  // ****************************** Inner Classes *****************************

  // ********************************* Methods ********************************

  // --- init -----------------------------------------------------------------

  // --- get&set --------------------------------------------------------------

  /**
   * Returns the unique identifier of the exception. The identifier is used to
   * track an exception in different tiers.
   * <p>
   * This identifier must never be <code>null</code>.
   *
   * @return the unique identifier of the exception.
   */
  public ExceptionId<?> getId()
  {
    return info.getId();
  }

  /**
   * Returns the error or exception code of the exception.
   * <p>
   * This code must never be <code>null</code>.
   *
   * @return the error or exception code of the exception.
   */
  public Code getCode()
  {
    return info.getCode();
  }

  /**
   * {@inheritDoc}
   *
   * @see de.smartics.exceptions.CoreException#getTime()
   */
  public Date getTime()
  {
    return info.getTime();
  }

  /**
   * {@inheritDoc}
   *
   * @see java.lang.Throwable#getCause()
   */
  @Override
  public Throwable getCause()
  {
    if (Helper.getThrowableHandleMode() == ThrowableHandleMode.NORMAL)
    {
      return super.getCause();
    }
    else
    {
      return info.removeableCause;
    }
  }

  // --- business -------------------------------------------------------------

  /**
   * {@inheritDoc}
   *
   * @see de.smartics.exceptions.CoreException#truncateCause()
   */
  public void truncateCause()
  {
    Helper.truncateCause(this, this.info);
  }

  // --- object basics --------------------------------------------------------

  /**
   * Returns the string representation of the object for debugging.
   *
   * @return the string representation of the object.
   */
  public String toString()
  {
    final StringBuilder buffer = new StringBuilder();
    final String message = getLocalizedMessage();
    buffer.append(this.info);
    if (message != null)
    {
      buffer.append(": ").append(message);
    }

    return buffer.toString();
  }
}