CPD Results

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

Duplications

File Line
de\smartics\maven\exceptions\report\CodeSortedSinkReportGenerator.java 71
de\smartics\maven\exceptions\report\ComponentCodeSortedSinkReportGenerator.java 72
    Collections.sort(items, new MixedCodeComparator());
    return items;
  }

  @Override
  protected String getCurrentSelection(final ExceptionCodeReportItem item)
  {
    final Code code = item.getCode();

    if (code instanceof NumberCode)
    {
      final NumberCode numberCode = (NumberCode) code;
      final String codeMajorNumber =
          String.valueOf(numberCode.getMajorNumber());
      return codeMajorNumber;
    }

    return code.getComponentId();
  }

  @Override
  protected boolean hasSectionChanged(String currentSection,
      final ExceptionCodeReportItem item)
  {
    final Code code = item.getCode();

    boolean headerChanged;
    if (code instanceof NumberCode)
    {
      final NumberCode numberCode = (NumberCode) code;
      final String codeMajorNumber =
          String.valueOf(numberCode.getMajorNumber());
      headerChanged = !ObjectUtils.equals(currentSection, codeMajorNumber);
    }
    else
    {
      final String componentId = code.getComponentId();
      headerChanged = !ObjectUtils.equals(currentSection, componentId);
    }

    return headerChanged;
  }

  @Override
  protected String getCodeTitle(final String headLine,
      final ExceptionCodeReportItem item)
  {
    final String title;
    if (headLine != null)
    {
      title = headLine;
    }
    else
    {
      final String code = item.getCode().getCode();
File Line
de\smartics\maven\exceptions\conf\DefaultJavadocProjectConfiguration.java 177
de\smartics\maven\exceptions\conf\DefaultProjectConfiguration.java 287
    public Builder(final String projectName)
    {
      this.projectName = projectName;
    }

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

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

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

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

    /**
     * Sets the classpath used by the tool.
     *
     * @param toolClassPath the classpath used by the tool.
     */
    public void setToolClassPath(final List<String> toolClassPath)
    {
      this.toolClassPath = toolClassPath;
    }

    /**
     * Sets the list of class path root elements of this project.
     *
     * @param classRootDirectoryNames the list of class path root elements of
     *          this project.
     */
    public void setClassRootDirectoryNames(
        final Collection<String> classRootDirectoryNames)
    {
      this.classRootDirectoryNames = classRootDirectoryNames;
    }

    /**
     * Sets the list of source path root elements of this project.
     *
     * @param sourceRootDirectoryNames the list of source path root elements of
     *          this project.
     */
    public void setSourceRootDirectoryNames(
        final Collection<String> sourceRootDirectoryNames)
    {
      this.sourceRootDirectoryNames = sourceRootDirectoryNames;
    }

    /**
     * Sets the includes for the scanner.
     *
     * @param includes the includes for the scanner.
     */
    public void setIncludes(final List<String> includes)
    {
      this.includes = includes;
    }

    /**
     * Sets the excludes for the scanner.
     *
     * @param excludes the excludes for the scanner.
     */
    public void setExcludes(final List<String> excludes)
    {
      this.excludes = excludes;
    }

    /**
     * Sets the encoding of the source files in this project.
     *
     * @param sourceEncoding the encoding of the source files in this project.
     */
    public void setSourceEncoding(final String sourceEncoding)
    {
      this.sourceEncoding = sourceEncoding;
    }

    /**
     * Sets the encoding of the source files in this project. Defaults to
     * <code>1.5</code>.
     *
     * @param sourceVersion the encoding of the source files in this project.
     */
    public void setSourceVersion(final String sourceVersion)
    {
      this.sourceVersion = sourceVersion;
    }

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

    /**
     * Creates the project configuration.
     *
     * @return the project configuration.
     * @throws IllegalArgumentException if any property is not valid.
     */
    public JavadocProjectConfiguration build() throws IllegalArgumentException
File Line
de\smartics\maven\exceptions\AbstractSdocCodeMojo.java 418
de\smartics\maven\exceptions\ExceptionCodeReport.java 334
      final ProjectConfiguration<File> projectConfig)
  {
    final ReportConfiguration reportConfig = new ReportConfiguration();
    reportConfig.setEncoding(this.sourceEncoding);
    final ProjectClassLoader classLoader =
        new ProjectClassLoader(Thread.currentThread().getContextClassLoader(),
            projectConfig.getClassRootDirectoryNames());
    reportConfig.setProjectClassLoader(classLoader);
    for (final String name : projectConfig.getSourceRootDirectoryNames())
    {
      final File file = new File(name);
      reportConfig.addSourceTree(file);
    }

    reportConfig.addIncludes(projectConfig.getIncludes());
    reportConfig.addExcludes(projectConfig.getExcludes());

    return reportConfig;
  }