aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-03-17 10:00:17 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2015-03-17 10:00:17 +0100
commit707572f2a6702c04d4941d2cb41382ef9853284d (patch)
treed69d8f28c700c3244b02c144ff663ff4512f4c38 /sonar-plugin-api/src
parent7f32a128f3997c0fe8fa32b3462129faace2c154 (diff)
downloadsonarqube-707572f2a6702c04d4941d2cb41382ef9853284d.tar.gz
sonarqube-707572f2a6702c04d4941d2cb41382ef9853284d.zip
Revert "Remove use of DateUtils.truncate since it is not efficient"
This reverts commit 46e1d76cc3814518f23b65132e5a8f083bb707a5.
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java8
1 files changed, 5 insertions, 3 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 04051ae4527..05d5d0fc5bd 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;
@@ -333,7 +334,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;
}
@@ -344,7 +346,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;
}
@@ -355,7 +357,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;
}