Don't throw IOException from ChangeInserter.createChange

This IOException is only thrown when the UTF-8 encoding is not
available which is an illegal state. Hence we should rather wrap the
IOException into an IllegalStateException. This makes the method
signature cleaner and callers don't need to handle the IOException.

In JGit the ChangeIdUtil.computeChangeId method was updated so that it
no longer throws the IOException [1]. Once we upgrade to a JGit
version that contains this change we can remove the exception handling
completely.

[1] https://git.eclipse.org/r/64670

Change-Id: I2839b1f640159a30d791c5063351162f004a65b0
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-01-20 07:51:11 +01:00
parent 6e1b2aa088
commit d5e930c05f
4 changed files with 18 additions and 14 deletions

View File

@@ -1751,8 +1751,8 @@ public class ReceiveCommits {
ListenableFuture<Void> future = changeUpdateExector.submit(
requestScopePropagator.wrap(new Callable<Void>() {
@Override
public Void call() throws IOException, OrmException,
RestApiException, UpdateException {
public Void call() throws OrmException, RestApiException,
UpdateException {
if (caller == Thread.currentThread()) {
insertChange(ReceiveCommits.this.db);
} else {
@@ -1768,7 +1768,7 @@ public class ReceiveCommits {
}
private void insertChange(ReviewDb threadLocalDb)
throws IOException, OrmException, RestApiException, UpdateException {
throws OrmException, RestApiException, UpdateException {
final PatchSet ps = ins.setGroups(groups).getPatchSet();
final Account.Id me = user.getAccountId();
final List<FooterLine> footerLines = commit.getFooterLines();