Source:
public Response<?> apply(ReviewerResource rsrc, Input input) throws AuthException, ResourceNotFoundException, OrmException, IOException { ChangeControl control = rsrc.getControl(); Change.Id changeId = rsrc.getChange().getId(); ReviewDb db = dbProvider.get(); ChangeUpdate update = updateFactory.create(rsrc.getChange()); StringBuilder msg = new StringBuilder(); db.changes().beginTransaction(changeId); try { List<PatchSetApproval> del = Lists.newArrayList(); for (PatchSetApproval a : approvals(db, rsrc)) { if (control.canRemoveReviewer(a)) { del.add(a); if (a.getValue() != 0) { if (msg.length() == 0) { msg.append("Removed the following approvals:\n\n"); } msg.append("* ") .append(a.getLabel()).append(formatLabelValue(a.getValue())) .append(" by ").append(userFactory.create(a.getAccountId()).getNameEmail()) .append("\n"); } } else { throw new AuthException("delete not permitted"); } } if (del.isEmpty()) { throw new ResourceNotFoundException(); } ChangeUtil.bumpRowVersionNotLastUpdatedOn(rsrc.getChange().getId(), db); db.patchSetApprovals().delete(del); update.removeReviewer(rsrc.getUser().getAccountId()); if (msg.length() > 0) { ChangeMessage changeMessage = new ChangeMessage(new ChangeMessage.Key(rsrc.getChange().getId(), ChangeUtil.messageUUID(db)), ((IdentifiedUser) control.getCurrentUser()).getAccountId(), TimeUtil.nowTs(), rsrc.getChange().currentPatchSetId()); changeMessage.setMessage(msg.toString()); db.changeMessages().insert(Collections.singleton(changeMessage)); } db.commit(); } finally { db.rollback(); } CheckedFuture<?, IOException> indexFuture = indexer.indexAsync(rsrc.getChange().getId()); update.commit(); indexFuture.checkedGet(); return Response.none(); }

Target:
public Response<?> apply(ReviewerResource rsrc, Input input) throws AuthException, ResourceNotFoundException, OrmException, IOException { ChangeControl control = rsrc.getControl(); Change.Id changeId = rsrc.getChange().getId(); ReviewDb db = dbProvider.get(); ChangeUpdate update = updateFactory.create(rsrc.getChange()); StringBuilder msg = new StringBuilder(); db.changes().beginTransaction(changeId); try { List<PatchSetApproval> del = Lists.newArrayList(); for (PatchSetApproval a : approvals(db, rsrc)) { if (control.canRemoveReviewer(a)) { del.add(a); if (a.getValue() != 0) { if (msg.length() == 0) { msg.append("Removed the following approvals:\n\n"); } msg.append("* ") .append(a.getLabel()).append(formatLabelValue(a.getValue())) .append(" by ").append(userFactory.create(a.getAccountId()).getNameEmail()) .append("\n"); } } else { throw new AuthException("delete not permitted"); } } if (del.isEmpty()) { throw new ResourceNotFoundException(); } ChangeUtil.bumpRowVersionNotLastUpdatedOn(rsrc.getChange().getId(), db); db.patchSetApprovals().delete(del); update.removeReviewer(rsrc.getUser().getAccountId()); if (msg.length() > 0) { ChangeMessage changeMessage = new ChangeMessage(new ChangeMessage.Key(rsrc.getChange().getId(), ChangeUtil.messageUUID(db)), ((IdentifiedUser) control.getCurrentUser()).getAccountId(), TimeUtil.nowTs(), rsrc.getChange().currentPatchSetId()); changeMessage.setMessage(msg.toString()); db.changeMessages().insert(Collections.singleton(changeMessage)); } db.commit(); } finally { db.rollback(); } update.commit(); indexer.index(db, rsrc.getChange()); return Response.none(); }