Fix dropped IOException in GetPatch

Do not drop the exception on the floor. Allow an unexpected
IOException to go up to RestApiServlet where it will be logged and
may turn into an HTTP 500 to the client.

Change-Id: I3efe714ca30668c9d3bb93f2a3c68a50ce780531
This commit is contained in:
Shawn Pearce
2014-02-19 16:51:26 -08:00
committed by David Ostrovsky
parent e666236369
commit d5db8c0109

View File

@@ -18,7 +18,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.gerrit.extensions.restapi.BinaryResult;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
import com.google.gerrit.extensions.restapi.RestReadView;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.git.GitRepositoryManager;
@@ -57,11 +56,10 @@ public class GetPatch implements RestReadView<RevisionResource> {
@Override
public BinaryResult apply(RevisionResource rsrc)
throws ResourceNotFoundException, ResourceConflictException {
throws ResourceConflictException, IOException {
Project.NameKey project = rsrc.getControl().getProject().getNameKey();
boolean close = true;
try {
final Repository repo = repoManager.openRepository(project);
boolean close = true;
try {
final RevWalk rw = new RevWalk(repo);
try {
@@ -133,9 +131,6 @@ public class GetPatch implements RestReadView<RevisionResource> {
repo.close();
}
}
} catch (IOException e) {
throw new ResourceNotFoundException();
}
}
private static String formatEmailHeader(RevCommit commit) {