From 35a71b925779d7c6c8f861f1b31b16a0d197b206 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 17 Feb 2012 18:42:35 -0500
Subject: [PATCH] Fixed date bugs on IssueModel
---
src/com/gitblit/utils/JsonUtils.java | 3 ++-
src/com/gitblit/models/IssueModel.java | 7 ++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/com/gitblit/models/IssueModel.java b/src/com/gitblit/models/IssueModel.java
index 246b29b..3c191e2 100644
--- a/src/com/gitblit/models/IssueModel.java
+++ b/src/com/gitblit/models/IssueModel.java
@@ -59,7 +59,8 @@
public List<Change> changes;
public IssueModel() {
- created = new Date((System.currentTimeMillis() / 1000) * 1000);
+ // the first applied change set the date appropriately
+ created = new Date(0);
type = Type.Defect;
status = Status.New;
@@ -117,6 +118,10 @@
}
public void applyChange(Change change) {
+ if (changes.size() == 0) {
+ // first change created the issue
+ created = change.created;
+ }
changes.add(change);
if (change.hasFieldChanges()) {
diff --git a/src/com/gitblit/utils/JsonUtils.java b/src/com/gitblit/utils/JsonUtils.java
index aea46bb..bc9a1e0 100644
--- a/src/com/gitblit/utils/JsonUtils.java
+++ b/src/com/gitblit/utils/JsonUtils.java
@@ -295,7 +295,8 @@
JsonDeserializationContext jsonDeserializationContext) {
try {
synchronized (dateFormat) {
- return dateFormat.parse(jsonElement.getAsString());
+ Date date = dateFormat.parse(jsonElement.getAsString());
+ return new Date((date.getTime() / 1000) * 1000);
}
} catch (ParseException e) {
throw new JsonSyntaxException(jsonElement.getAsString(), e);
--
Gitblit v1.9.1