Catch all exceptions when async emailing.
Updated the asynchronous emailing code to catch Exception. Also, cleaned up some method signatures that had throws declarations for exceptions that were never thrown. Change-Id: I7525852b3672e07f7878f81c98cb7fc24ae4797b
This commit is contained in:
@@ -37,7 +37,6 @@ import com.google.gerrit.server.GerritPersonIdent;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.account.AccountCache;
|
||||
import com.google.gerrit.server.config.CanonicalWebUrl;
|
||||
import com.google.gerrit.server.mail.EmailException;
|
||||
import com.google.gerrit.server.mail.MergeFailSender;
|
||||
import com.google.gerrit.server.mail.MergedSender;
|
||||
import com.google.gerrit.server.patch.PatchSetInfoFactory;
|
||||
@@ -1047,7 +1046,7 @@ public class MergeOp {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isMergeable(Change c) throws OrmException {
|
||||
private boolean isMergeable(Change c) {
|
||||
final CodeReviewCommit commit = commits.get(c.getId());
|
||||
final CommitMergeStatus s = commit != null ? commit.statusCode : null;
|
||||
boolean isMergeable = false;
|
||||
@@ -1061,7 +1060,7 @@ public class MergeOp {
|
||||
return isMergeable;
|
||||
}
|
||||
|
||||
private void updateChangeStatus() throws MergeException {
|
||||
private void updateChangeStatus() {
|
||||
List<CodeReviewCommit> merged = new ArrayList<CodeReviewCommit>();
|
||||
|
||||
for (final Change c : submitted) {
|
||||
@@ -1127,7 +1126,7 @@ public class MergeOp {
|
||||
GitRepositoryManager.REFS_NOTES_REVIEW);
|
||||
}
|
||||
|
||||
private void updateSubscriptions() throws MergeException {
|
||||
private void updateSubscriptions() {
|
||||
if (mergeTip != null && (branchTip == null || branchTip != mergeTip)) {
|
||||
SubmoduleOp subOp =
|
||||
subOpFactory.create(destBranch, mergeTip, rw, repo, destProject,
|
||||
@@ -1410,7 +1409,7 @@ public class MergeOp {
|
||||
} finally {
|
||||
reviewDb.close();
|
||||
}
|
||||
} catch (OrmException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("Cannot send email for submitted patch set " + c.getId(), e);
|
||||
return;
|
||||
}
|
||||
@@ -1422,7 +1421,7 @@ public class MergeOp {
|
||||
}
|
||||
cm.setPatchSet(patchSet);
|
||||
cm.send();
|
||||
} catch (EmailException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("Cannot send email for submitted patch set " + c.getId(), e);
|
||||
}
|
||||
}
|
||||
@@ -1493,7 +1492,7 @@ public class MergeOp {
|
||||
} finally {
|
||||
reviewDb.close();
|
||||
}
|
||||
} catch (OrmException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("Cannot send email notifications about merge failure", e);
|
||||
return;
|
||||
}
|
||||
@@ -1506,7 +1505,7 @@ public class MergeOp {
|
||||
cm.setPatchSet(patchSet);
|
||||
cm.setChangeMessage(msg);
|
||||
cm.send();
|
||||
} catch (EmailException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("Cannot send email notifications about merge failure", e);
|
||||
}
|
||||
}
|
||||
|
@@ -44,7 +44,6 @@ import com.google.gerrit.server.config.CanonicalWebUrl;
|
||||
import com.google.gerrit.server.config.TrackingFooters;
|
||||
import com.google.gerrit.server.git.MultiProgressMonitor.Task;
|
||||
import com.google.gerrit.server.mail.CreateChangeSender;
|
||||
import com.google.gerrit.server.mail.EmailException;
|
||||
import com.google.gerrit.server.mail.MergedSender;
|
||||
import com.google.gerrit.server.mail.ReplacePatchSetSender;
|
||||
import com.google.gerrit.server.patch.PatchSetInfoFactory;
|
||||
@@ -1122,7 +1121,7 @@ public class ReceiveCommits {
|
||||
cm.addReviewers(reviewers);
|
||||
cm.addExtraCC(cc);
|
||||
cm.send();
|
||||
} catch (EmailException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("Cannot send email for new change " + change.getId(), e);
|
||||
}
|
||||
}
|
||||
@@ -1473,7 +1472,7 @@ public class ReceiveCommits {
|
||||
cm.addReviewers(oldReviewers);
|
||||
cm.addExtraCC(oldCC);
|
||||
cm.send();
|
||||
} catch (EmailException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("Cannot send email for new patch set " + ps.getId(), e);
|
||||
}
|
||||
}
|
||||
@@ -2012,7 +2011,7 @@ public class ReceiveCommits {
|
||||
cm.setFrom(currentUser.getAccountId());
|
||||
cm.setPatchSet(result.patchSet, result.info);
|
||||
cm.send();
|
||||
} catch (EmailException e) {
|
||||
} catch (Exception e) {
|
||||
final PatchSet.Id psi = result.patchSet.getId();
|
||||
log.error("Cannot send email for submitted patch set " + psi, e);
|
||||
}
|
||||
|
@@ -30,7 +30,6 @@ import com.google.gerrit.server.ChangeUtil;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.git.WorkQueue;
|
||||
import com.google.gerrit.server.mail.CommentSender;
|
||||
import com.google.gerrit.server.mail.EmailException;
|
||||
import com.google.gerrit.server.project.ChangeControl;
|
||||
import com.google.gerrit.server.project.InvalidChangeOperationException;
|
||||
import com.google.gerrit.server.project.NoSuchChangeException;
|
||||
@@ -332,7 +331,7 @@ public class PublishComments implements Callable<VoidResult> {
|
||||
} catch (PatchSetInfoNotAvailableException e) {
|
||||
log.error("Cannot read PatchSetInfo of " + patchSetId, e);
|
||||
return;
|
||||
} catch (OrmException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("Cannot email comments for " + patchSetId, e);
|
||||
return;
|
||||
}
|
||||
@@ -344,7 +343,7 @@ public class PublishComments implements Callable<VoidResult> {
|
||||
cm.setChangeMessage(message);
|
||||
cm.setPatchLineComments(drafts);
|
||||
cm.send();
|
||||
} catch (EmailException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("Cannot email comments for " + patchSetId, e);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user