diff --git a/pom.xml b/pom.xml index 5e67c117db..3295e732db 100644 --- a/pom.xml +++ b/pom.xml @@ -305,7 +305,7 @@ org.mockito - mockito-all + mockito-core ${mockito.version} test diff --git a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java index 00dd747bdf..afb5249b25 100644 --- a/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java +++ b/scm-plugins/scm-hg-plugin/src/test/java/sonia/scm/repository/spi/HgCatCommandTest.java @@ -42,8 +42,6 @@ import java.io.InputStream; import static org.junit.Assert.assertEquals; -//~--- JDK imports ------------------------------------------------------------ - public class HgCatCommandTest extends AbstractHgCommandTestBase { @Test diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/ContentResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/ContentResource.java index ae209b4238..0936a5b4a0 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/ContentResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/ContentResource.java @@ -73,17 +73,17 @@ public class ContentResource { private StreamingOutput createStreamingOutput(@PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("revision") String revision, @PathParam("path") String path, RepositoryService repositoryService) { return os -> { - try { - repositoryService.getCatCommand().setRevision(revision).retriveContent(os, path); - os.close(); - } catch (PathNotFoundException e) { - LOG.debug("path '{}' not found in repository {}/{}", path, namespace, name, e); - throw new WebApplicationException(Status.NOT_FOUND); - } catch (RepositoryException e) { - LOG.info("error reading repository resource {} from {}/{}", path, namespace, name, e); - throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR); - } - }; + try { + repositoryService.getCatCommand().setRevision(revision).retriveContent(os, path); + os.close(); + } catch (PathNotFoundException e) { + LOG.debug("path '{}' not found in repository {}/{}", path, namespace, name, e); + throw new WebApplicationException(Status.NOT_FOUND); + } catch (RepositoryException e) { + LOG.info("error reading repository resource {} from {}/{}", path, namespace, name, e); + throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR); + } + }; } /** @@ -107,7 +107,7 @@ public class ContentResource { }) public Response metadata(@PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("revision") String revision, @PathParam("path") String path) { try (RepositoryService repositoryService = serviceFactory.create(new NamespaceAndName(namespace, name))) { - Response.ResponseBuilder responseBuilder = Response.ok(); + Response.ResponseBuilder responseBuilder = Response.ok(); return createContentHeader(namespace, name, revision, path, repositoryService, responseBuilder); } catch (RepositoryNotFoundException e) { LOG.debug("path '{}' not found in repository {}/{}", path, namespace, name, e); @@ -124,10 +124,7 @@ public class ContentResource { } catch (RevisionNotFoundException e) { LOG.debug("revision '{}' not found in repository {}/{}", revision, namespace, name, e); return Response.status(Status.NOT_FOUND).build(); - } catch (IOException e) { - LOG.info("error reading repository resource {} from {}/{}", path, namespace, name, e); - return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); - } catch (RepositoryException e) { + } catch (IOException | RepositoryException e) { LOG.info("error reading repository resource {} from {}/{}", path, namespace, name, e); return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); }