Remove StorageException from throws clauses

Change-Id: I48a0169293ddf766fbbd924cb310f9b8dacc58cf
This commit is contained in:
Dave Borowitz
2019-01-15 19:16:44 -08:00
parent a4fe999a75
commit bd856a44ba
386 changed files with 1022 additions and 1607 deletions

View File

@@ -103,17 +103,16 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
this.projectCache = projectCache;
}
public ChangeNotes createChecked(Change c) throws StorageException {
public ChangeNotes createChecked(Change c) {
return createChecked(c.getProject(), c.getId());
}
public ChangeNotes createChecked(Project.NameKey project, Change.Id changeId)
throws StorageException {
public ChangeNotes createChecked(Project.NameKey project, Change.Id changeId) {
Change change = newChange(project, changeId);
return new ChangeNotes(args, change, true, null).load();
}
public ChangeNotes createChecked(Change.Id changeId) throws StorageException {
public ChangeNotes createChecked(Change.Id changeId) {
InternalChangeQuery query = queryProvider.get().noFields();
List<ChangeData> changes = query.byLegacyChangeId(changeId);
if (changes.isEmpty()) {
@@ -131,7 +130,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
null, changeId, null, new Branch.NameKey(project, "INVALID_NOTE_DB_ONLY"), null);
}
public ChangeNotes create(Project.NameKey project, Change.Id changeId) throws StorageException {
public ChangeNotes create(Project.NameKey project, Change.Id changeId) {
checkArgument(project != null, "project is required");
return new ChangeNotes(args, newChange(project, changeId), true, null).load();
}
@@ -147,16 +146,15 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
return new ChangeNotes(args, change, true, null);
}
public ChangeNotes createForBatchUpdate(Change change, boolean shouldExist)
throws StorageException {
public ChangeNotes createForBatchUpdate(Change change, boolean shouldExist) {
return new ChangeNotes(args, change, shouldExist, null).load();
}
public ChangeNotes create(Change change, RefCache refs) throws StorageException {
public ChangeNotes create(Change change, RefCache refs) {
return new ChangeNotes(args, change, true, refs).load();
}
public List<ChangeNotes> create(Collection<Change.Id> changeIds) throws StorageException {
public List<ChangeNotes> create(Collection<Change.Id> changeIds) {
List<ChangeNotes> notes = new ArrayList<>();
for (Change.Id changeId : changeIds) {
try {
@@ -169,8 +167,9 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
}
public List<ChangeNotes> create(
Project.NameKey project, Collection<Change.Id> changeIds, Predicate<ChangeNotes> predicate)
throws StorageException {
Project.NameKey project,
Collection<Change.Id> changeIds,
Predicate<ChangeNotes> predicate) {
List<ChangeNotes> notes = new ArrayList<>();
for (Change.Id cid : changeIds) {
try {
@@ -419,13 +418,12 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
return commentKeys;
}
public ImmutableListMultimap<RevId, Comment> getDraftComments(Account.Id author)
throws StorageException {
public ImmutableListMultimap<RevId, Comment> getDraftComments(Account.Id author) {
return getDraftComments(author, null);
}
public ImmutableListMultimap<RevId, Comment> getDraftComments(
Account.Id author, @Nullable Ref ref) throws StorageException {
Account.Id author, @Nullable Ref ref) {
loadDraftComments(author, ref);
// Filter out any zombie draft comments. These are drafts that are also in
// the published map, and arise when the update to All-Users to delete them
@@ -435,7 +433,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
draftCommentNotes.getComments(), e -> !getCommentKeys().contains(e.getValue().key)));
}
public ImmutableListMultimap<RevId, RobotComment> getRobotComments() throws StorageException {
public ImmutableListMultimap<RevId, RobotComment> getRobotComments() {
loadRobotComments();
return robotCommentNotes.getComments();
}
@@ -445,14 +443,14 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
* However, this method will load the comments if no draft comments have been loaded or if the
* caller would like the drafts for another author.
*/
private void loadDraftComments(Account.Id author, @Nullable Ref ref) throws StorageException {
private void loadDraftComments(Account.Id author, @Nullable Ref ref) {
if (draftCommentNotes == null || !author.equals(draftCommentNotes.getAuthor()) || ref != null) {
draftCommentNotes = new DraftCommentNotes(args, getChangeId(), author, ref);
draftCommentNotes.load();
}
}
private void loadRobotComments() throws StorageException {
private void loadRobotComments() {
if (robotCommentNotes == null) {
robotCommentNotes = new RobotCommentNotes(args, change);
robotCommentNotes.load();
@@ -468,7 +466,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
return robotCommentNotes;
}
public boolean containsComment(Comment c) throws StorageException {
public boolean containsComment(Comment c) {
if (containsCommentPublished(c)) {
return true;
}