CPD Results

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

Duplications

File Line
de\smartics\exceptions\AbstractCoreException.java 108
de\smartics\exceptions\AbstractCoreRuntimeException.java 111
  protected AbstractCoreException(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 --------------------------------------------------------------

  @Override
  public final ExceptionId<?> getId()
  {
    return info.getId();
  }

  @Override
  public final Code getCode()
  {
    return info.getCode();
  }

  @Override
  public final Date getTime()
  {
    return info.getTime();
  }

  @Override
  public final Throwable getCause()
  {
    if (Helper.getThrowableHandleMode() == ThrowableHandleMode.NORMAL)
    {
      return super.getCause();
    }
    else
    {
      return info.removeableCause;
    }
  }

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

  @Override
  public final void truncateCause()
  {
    Helper.truncateCause(this, this.info);
  }

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

  /**
   * Returns the string representation of the exception.
   * <p>
   * May be overridden by subclasses in an application (not a library) to change
   * the string representation. Usually an implementation of
   * {@code CodeMessageFormatter} should be set to the
   * {@link de.smartics.exceptions.ExceptionContext}.
   * </p>
   *
   * @return the string representation of the object.
   */
  @Override
  public String toString()
  {
    final CodeMessageFormatter formatter =
        ExceptionContextManager.getFormatter(Thread.currentThread()
            .getContextClassLoader());
    final String string = formatter.format(this);
    return string;
  }
}