Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
move source upload authorization exception handling to lower level
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed Jul 16, 2013
1 parent 5e14a3a commit 1cc81e2
Showing 1 changed file with 9 additions and 8 deletions.
Expand Up @@ -226,12 +226,6 @@ public Response uploadSourceFile( @PathParam("projectSlug") String projectSlug,
}
return sourceUploadSuccessResponse(isNewDocument(projectSlug, iterationSlug, docId), totalChunks);
}
catch (AuthorizationException e)
{
return Response.status(Status.UNAUTHORIZED)
.entity(new ChunkUploadResponse(e.getMessage()))
.build();
}
catch (ChunkUploadException e)
{
return Response.status(e.getStatusCode())
Expand Down Expand Up @@ -260,8 +254,15 @@ private InputStream getInputStream(Optional<File> tempFile, DocumentFileUploadFo

private void checkSourceUploadPreconditions(String projectSlug, String iterationSlug, String docId, DocumentFileUploadForm uploadForm)
{
checkUploadPreconditions(projectSlug, iterationSlug, docId, uploadForm);
checkSourceUploadAllowed(projectSlug, iterationSlug);
try
{
checkUploadPreconditions(projectSlug, iterationSlug, docId, uploadForm);
checkSourceUploadAllowed(projectSlug, iterationSlug);
}
catch (AuthorizationException e)
{
throw new ChunkUploadException(Status.UNAUTHORIZED, e.getMessage());
}
checkValidSourceUploadType(uploadForm);
}

Expand Down

0 comments on commit 1cc81e2

Please sign in to comment.