Remove usages of System.currentTimeMillis() from gerrit-reviewdb

Unlike pure server code, reviewdb.client is used from GWT, so we
cannot just use joda's DateTimeUtils.currentTimeMillis(). Instead,
just introduce arguments where necessary. Passing TimeUtil.nowTs() is
a bit cumbersome but usually short enough to type.

Change-Id: I87ef09b0920bc36851bca893a2a37348ffc6bf3a
This commit is contained in:
Dave Borowitz
2013-10-16 08:30:43 -07:00
parent 1d69c2e8ce
commit 288ed98c01
38 changed files with 123 additions and 121 deletions

View File

@@ -66,6 +66,7 @@ import com.google.gwtorm.client.KeyUtil;
import org.eclipse.jgit.diff.Edit;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
@@ -523,9 +524,10 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
throw new RuntimeException("unexpected file id " + file);
}
final PatchLineComment newComment =
new PatchLineComment(new PatchLineComment.Key(parentKey, null),
line, Gerrit.getUserAccount().getId(), null);
final PatchLineComment newComment = new PatchLineComment(
new PatchLineComment.Key(parentKey, null), line,
Gerrit.getUserAccount().getId(), null,
new Timestamp(System.currentTimeMillis()));
newComment.setSide(side);
newComment.setMessage("");
@@ -969,7 +971,8 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
PatchLineComment newComment =
new PatchLineComment(new PatchLineComment.Key(comment.getKey()
.getParentKey(), null), comment.getLine(), Gerrit
.getUserAccount().getId(), comment.getKey().get());
.getUserAccount().getId(), comment.getKey().get(),
new Timestamp(System.currentTimeMillis()));
newComment.setSide(comment.getSide());
return newComment;
}