aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-08-08 14:05:22 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2013-08-08 14:05:47 +0200
commit31d3e8ca7e8a489ade06a98efaaf4684b3124f51 (patch)
tree79109809179dfdf19120e1f29d7cf90fa4e5815e /sonar-plugin-api/src
parent475eab492b95cc7e2c755bdadc6d6238382b8bef (diff)
downloadsonarqube-31d3e8ca7e8a489ade06a98efaaf4684b3124f51.tar.gz
sonarqube-31d3e8ca7e8a489ade06a98efaaf4684b3124f51.zip
SONAR-4564 SONAR-4563 fix detection of new issues since previous analysis
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java
index 739ec339918..b739523a0d7 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java
@@ -29,6 +29,7 @@ import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
+import org.apache.commons.lang.time.DateUtils;
import org.sonar.api.issue.Issue;
import org.sonar.api.issue.IssueComment;
import org.sonar.api.rule.RuleKey;
@@ -37,10 +38,7 @@ import org.sonar.api.rule.Severity;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import java.io.Serializable;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* PLUGINS MUST NOT BE USED THIS CLASS, EXCEPT FOR UNIT TESTING.
@@ -233,7 +231,8 @@ public class DefaultIssue implements Issue {
}
public DefaultIssue setCreationDate(Date d) {
- this.creationDate = d;
+ // d is not marked as Nullable but we still allow null parameter for unit testing.
+ this.creationDate = (d != null ? DateUtils.truncate(d, Calendar.SECOND) : null);
return this;
}
@@ -243,7 +242,7 @@ public class DefaultIssue implements Issue {
}
public DefaultIssue setUpdateDate(@Nullable Date d) {
- this.updateDate = d;
+ this.updateDate = (d != null ? DateUtils.truncate(d, Calendar.SECOND) : null);
return this;
}
@@ -253,7 +252,7 @@ public class DefaultIssue implements Issue {
}
public DefaultIssue setCloseDate(@Nullable Date d) {
- this.closeDate = d;
+ this.closeDate = (d != null ? DateUtils.truncate(d, Calendar.SECOND) : null);
return this;
}