Source:
<code>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.getControl()); 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); log.debug("User removed <START> approval record on <END> {}", ((IdentifiedUser)currentUser.get()).getAccountId(), control.getChange().currentPatchSetId()); if (a.getPatchSetId().equals(control.getChange().currentPatchSetId()) && a.getValue() != 0) { if (msg.length() == 0) { msg.append("Removed the following votes:\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()); cmUtil.addChangeMessage(db, update, changeMessage); } db.commit(); } finally { db.rollback(); } update.commit(); indexer.index(db, rsrc.getChange()); return Response.none(); }</code><technical_language>"record" is redundant; "approval" "vote" fine</technical_language>

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.getControl()); 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); log.debug("User removed approval of on {}", ((IdentifiedUser)currentUser.get()).getAccountId(), a.getAccountId(), control.getChange().currentPatchSetId()); if (a.getPatchSetId().equals(control.getChange().currentPatchSetId()) && a.getValue() != 0) { if (msg.length() == 0) { msg.append("Removed the following votes:\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()); cmUtil.addChangeMessage(db, update, changeMessage); } db.commit(); } finally { db.rollback(); } update.commit(); indexer.index(db, rsrc.getChange()); return Response.none(); }