Use try/multi-catch

Change-Id: Icf5042cccb0662d6bd53302800e03211af94c16d
This commit is contained in:
Urs Wolfer
2015-06-24 20:06:25 +02:00
committed by David Pursehouse
parent 8702786e5a
commit 64cfaf242d
39 changed files with 51 additions and 174 deletions

View File

@@ -238,11 +238,7 @@ public class CatServlet extends HttpServlet {
return;
}
}
} catch (IOException e) {
getServletContext().log("Cannot read repository", e);
rsp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
} catch (RuntimeException e) {
} catch (IOException | RuntimeException e) {
getServletContext().log("Cannot read repository", e);
rsp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;

View File

@@ -66,13 +66,8 @@ public abstract class Handler<T> implements Callable<T> {
if (r != null) {
callback.onSuccess(r);
}
} catch (NoSuchProjectException e) {
callback.onFailure(new NoSuchEntityException());
} catch (NoSuchRefException e) {
callback.onFailure(new NoSuchEntityException());
} catch (NoSuchChangeException e) {
} catch (NoSuchProjectException | NoSuchChangeException
| NoSuchRefException e) {
callback.onFailure(new NoSuchEntityException());
} catch (OrmException e) {

View File

@@ -234,11 +234,8 @@ class AccountSecurityImpl extends BaseServiceImplementation implements
} else {
throw new EmailTokenVerifier.InvalidTokenException();
}
} catch (EmailTokenVerifier.InvalidTokenException e) {
callback.onFailure(e);
} catch (AccountException e) {
callback.onFailure(e);
} catch (OrmException e) {
} catch (EmailTokenVerifier.InvalidTokenException | OrmException
| AccountException e) {
callback.onFailure(e);
}
}

View File

@@ -146,9 +146,7 @@ public abstract class ProjectAccessHandler<T> extends Handler<T> {
"You are not allowed to change the parent project since you are "
+ "not an administrator. You may save the modifications for review "
+ "so that an administrator can approve them.", e);
} catch (ResourceConflictException e) {
throw new UpdateParentFailedException(e.getMessage(), e);
} catch (UnprocessableEntityException e) {
} catch (ResourceConflictException | UnprocessableEntityException e) {
throw new UpdateParentFailedException(e.getMessage(), e);
}
config.getProject().setParentName(parentProjectName);