/** {@inheritDoc} */ protected void printError(Duplication item, String severity) { int lines = item.getLines(); StringBuilder buff = new StringBuilder(100); buff.append("CPD " + severity + ": Found "); buff.append(lines).append(" lines of duplicated code at locations:"); this.getLog().info(buff.toString()); for (CpdFile file : item.getFiles()) { buff.setLength(0); buff.append(" "); buff.append(file.getPath()); buff.append(" line ").append(file.getLine()); this.getLog().info(buff.toString()); } this.getLog().debug("CPD " + severity + ": Code Fragment "); this.getLog().debug(item.getCodefragment()); }
@Override protected boolean isExcludedFromFailure(final Duplication errorDetail) { final Set<String> uniquePaths = new HashSet<String>(); for (final CpdFile cpdFile : errorDetail.getFiles()) { uniquePaths.add(cpdFile.getPath()); } for (final Set<String> singleExclusionGroup : exclusionList) { if (uniquePaths.size() == singleExclusionGroup.size() && duplicationExcludedByGroup(uniquePaths, singleExclusionGroup)) { return true; } } return false; }