private boolean isPartialSameFinding(Item newItem, Item oldItem) { final boolean result; if (oldItem.getFindingType().equals(newItem.getFindingType())) { if (oldItem.getOrigin().equals(Origin.CPD)) { // Fuzzy compare CPD Findings // see also http://www.jcoderz.org/fawkez/ticket/71 // The or is by intention due to resistant findings // reported as new frequently. result = oldItem.getLine() == newItem.getLine() || oldItem .getMessage() .regionMatches(0, newItem.getMessage(), 0, CPD_UNIQUE_STRING_LENGTH); } else { result = oldItem.getMessage().equals(newItem.getMessage()) && oldItem.getCounter() <= newItem.getCounter(); } } else { result = false; } return result; }
/* private */ static boolean isSameFinding(Item newItem, Item oldItem) { final boolean result; if (oldItem.getFindingType().equals(newItem.getFindingType())) { if (oldItem.getOrigin().equals(Origin.CPD)) { // Fuzzy compare CPD Findings // see also http://www.jcoderz.org/fawkez/ticket/71 result = oldItem.getLine() == newItem.getLine() && oldItem .getMessage() .regionMatches(0, newItem.getMessage(), 0, CPD_UNIQUE_STRING_LENGTH); } else { result = oldItem.getLine() == newItem.getLine() && oldItem.getColumn() == newItem.getColumn() && oldItem.getMessage().equals(newItem.getMessage()) && oldItem.getCounter() <= newItem.getCounter(); } } else { result = false; } return result; }