Merge "Merge branch 'stable-2.14'"

This commit is contained in:
David Pursehouse
2017-09-30 15:30:54 +00:00
committed by Gerrit Code Review

View File

@@ -167,22 +167,18 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
checkArgument(project != null, "project is required");
Change change = readOneReviewDbChange(db, changeId);
if (change == null && args.migration.readChanges()) {
// Change isn't in ReviewDb, but its primary storage might be in NoteDb.
// Prepopulate the change exists with proper noteDbState field.
change = newNoteDbOnlyChange(project, changeId);
} else {
checkNotNull(change, "change %s not found in ReviewDb", changeId);
checkArgument(
change.getProject().equals(project),
"passed project %s when creating ChangeNotes for %s, but actual project is %s",
project,
changeId,
change.getProject());
if (change == null) {
if (args.migration.readChanges()) {
return newNoteDbOnlyChange(project, changeId);
}
throw new NoSuchChangeException(changeId);
}
// TODO: Throw NoSuchChangeException when the change is not found in the
// database
checkArgument(
change.getProject().equals(project),
"passed project %s when creating ChangeNotes for %s, but actual project is %s",
project,
changeId,
change.getProject());
return change;
}