aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2015-04-28 11:40:41 +0200
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2015-04-28 11:40:41 +0200
commit2a0b90ac049f9bfca1c18b25eeb2146ebe09bf76 (patch)
treee6fa3c200de8bd03377c3e7720e36c8b9818772b /sonar-core
parent244a9a026b9f236fc2b155e139b109cf279c0b8e (diff)
downloadsonarqube-2a0b90ac049f9bfca1c18b25eeb2146ebe09bf76.tar.gz
sonarqube-2a0b90ac049f9bfca1c18b25eeb2146ebe09bf76.zip
Fix quality flaws
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java b/sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java
index 28ce4e2c26c..369abddfef5 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java
@@ -24,7 +24,7 @@ import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
-import org.apache.commons.collections.CollectionUtils;
+import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.sonar.api.BatchComponent;
@@ -42,6 +42,7 @@ import javax.annotation.Nullable;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
+import java.util.Set;
/**
* Updates issue fields and chooses if changes must be kept in history.
@@ -274,7 +275,7 @@ public class IssueUpdater implements BatchComponent, ServerComponent {
}
public boolean setTags(DefaultIssue issue, Collection<String> tags, IssueChangeContext context) {
- Collection<String> newTags = Collections2.transform(
+ Set<String> newTags = Sets.newHashSet(Collections2.transform(
Collections2.filter(tags, new Predicate<String>() {
@Override
public boolean apply(String tag) {
@@ -287,10 +288,11 @@ public class IssueUpdater implements BatchComponent, ServerComponent {
RuleTagFormat.validate(lowerCaseTag);
return lowerCaseTag;
}
- });
+ }));
- Collection<String> oldTags = issue.tags();
- if (!CollectionUtils.isEqualCollection(oldTags, newTags)) {
+ Set<String> oldTags = Sets.newHashSet(issue.tags());
+
+ if (!oldTags.equals(newTags)) {
issue.setFieldChange(context, TAGS,
oldTags.isEmpty() ? null : CHANGELOG_TAG_JOINER.join(oldTags),
newTags.isEmpty() ? null : CHANGELOG_TAG_JOINER.join(newTags));