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

@@ -53,6 +53,7 @@ import com.google.gerrit.server.index.ChangeIndexer;
import com.google.gerrit.server.mail.AddReviewerSender;
import com.google.gerrit.server.project.ChangeControl;
import com.google.gerrit.server.project.NoSuchProjectException;
import com.google.gerrit.server.util.TimeUtil;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -314,7 +315,8 @@ public class PostReviewers implements RestModifyView<ChangeResource, Input> {
LabelId id =
Iterables.getLast(ctl.getLabelTypes().getLabelTypes()).getLabelId();
PatchSetApproval dummyApproval = new PatchSetApproval(
new PatchSetApproval.Key(patchSetId, reviewerId, id), (short) 0);
new PatchSetApproval.Key(patchSetId, reviewerId, id), (short) 0,
TimeUtil.nowTs());
dummyApproval.cache(ctl.getChange());
return dummyApproval;
}