Skip to content

Commit

Permalink
Control message for AccessDeniedException
Browse files Browse the repository at this point in the history
  • Loading branch information
brianv0 committed Mar 29, 2017
1 parent a069bee commit 34e720f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public Response getChildren( @DefaultValue("100000") @QueryParam("max") int max,
} catch (NoSuchFileException ex){
throw new RestException(ex,404, "File doesn't exist", ex.getMessage());
} catch (AccessDeniedException ex){
throw new RestException(ex, 403);
throw new RestException(ex, 403, ex.getMessage());
} catch (NotDirectoryException ex){
throw new RestException(ex,404,"File exists, but Path is not a container");
} catch (IOException ex){
Expand Down Expand Up @@ -152,7 +152,7 @@ public Response createContainer(MultivaluedMap<String, String> formParams) throw
} catch (NoSuchFileException ex){
throw new RestException(ex ,404, "Parent file doesn't exist", ex.getMessage());
} catch (AccessDeniedException ex){
throw new RestException(ex, 403);
throw new RestException(ex, 403, ex.getMessage());
} catch (NotDirectoryException ex){
throw new RestException(ex, 404, "File exists, but Path is not a container");
} catch (IOException ex){
Expand Down Expand Up @@ -186,7 +186,7 @@ public Response createContainerJson(DatasetContainer container) throws IOExcepti
} catch (NoSuchFileException ex){
throw new RestException(ex ,404, "Parent file doesn't exist", ex.getMessage());
} catch (AccessDeniedException ex){
throw new RestException(ex, 403);
throw new RestException(ex, 403, ex.getMessage());
} catch (NotDirectoryException ex){
throw new RestException(ex, 404, "File exists, but Path is not a container");
} catch (IOException ex){
Expand Down Expand Up @@ -232,7 +232,7 @@ public Response deleteContainer() throws IOException{
} catch (NoSuchFileException ex){
throw new RestException(ex, 404, "Directory doesn't exist", ex.getMessage());
} catch (AccessDeniedException ex){
throw new RestException(ex, 403);
throw new RestException(ex, 403, ex.getMessage());
} catch (IOException ex){
Logger.getLogger(PermissionsResource.class.getName()).log(Level.WARNING, "Unknown exception", ex);
throw new RestException(ex, 500);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public Response getDataset(@PathParam("id") String path,
// TODO: Check exception
throw new RestException(ex, 400 , "The target is not a dataset", ex.getMessage());
} catch (AccessDeniedException ex){
throw new RestException(ex, 403);
throw new RestException(ex, 403, ex.getMessage());
} catch (IOException ex){
Logger.getLogger(PermissionsResource.class.getName()).log(Level.WARNING, "Unknown exception", ex);
throw new RestException(ex, 500);
Expand Down Expand Up @@ -199,7 +199,7 @@ public Response createDataset(java.nio.file.Path datasetPath, DatasetModel reqDs
} catch (NoSuchFileException ex){
throw new RestException(ex, 404, "Parent file doesn't exist", ex.getMessage());
} catch (AccessDeniedException ex){
throw new RestException(ex, 403);
throw new RestException(ex, 403, ex.getMessage());
} catch (NotDirectoryException ex){
throw new RestException(ex, 404, "File exists, but Path is not a container");
} catch (IOException ex){
Expand Down Expand Up @@ -294,7 +294,7 @@ private Response handleFileAlreadyExists(FileAlreadyExistsException ex, java.nio
locationHeader.put("Location", newUriBuilder.build());
throw new RestException(ex, 409, "A Location Already exists for that site", null, locationHeader);
}
throw new RestException(ex, 409);
throw new RestException(ex, 409, ex.getMessage(), ex.getCause().getMessage());
}

@PATCH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ public Response getHead(@DefaultValue("false") @QueryParam("refresh") boolean re
} catch (IllegalArgumentException ex){
throw new RestException(ex, 400 , "Unable to correctly process view", ex.getMessage());
} catch (NoSuchFileException ex){
throw new RestException(ex,404 , "File doesn't exist", ex.getMessage());
throw new RestException(ex, 404 , "File doesn't exist", ex.getMessage());
} catch (AccessDeniedException ex){
throw new RestException(ex, 403);
throw new RestException(ex, 403, ex.getMessage());
} catch (IOException ex){
Logger.getLogger(PermissionsResource.class.getName()).log(Level.WARNING, "Unknown exception", ex);
throw new RestException(ex, 500);
Expand Down Expand Up @@ -177,9 +177,9 @@ public Response getBean(String path, HashMap<String,List<String>> matrixParams,
} catch (NoSuchFileException ex){
throw new RestException(ex,404 , "File doesn't exist", ex.getMessage());
} catch (AccessDeniedException ex){
throw new RestException(ex, 403);
throw new RestException(ex, 403, ex.getMessage());
} catch (IOException ex){
Logger.getLogger(PermissionsResource.class.getName()).log(Level.WARNING, "Unknown exception", ex);
Logger.getLogger(PermissionsResource.class.getName()).log(Level.WARNING, "Unknown exception", ex);
throw new RestException(ex, 500);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public Response getAclOrPermissions(@DefaultValue("") @QueryParam("subject") Str
} catch (NoSuchFileException ex){
throw new RestException(ex,404 , "File doesn't exist", ex.getMessage());
} catch (AccessDeniedException ex){
throw new RestException(ex, 403);
throw new RestException(ex, 403, ex.getMessage());
} catch (IOException ex){
Logger.getLogger(PermissionsResource.class.getName()).log(Level.WARNING, "Unknown exception", ex);
throw new RestException(ex, 500);
Expand All @@ -104,7 +104,7 @@ public Response setAcl(List<AclEntryProxy> proxyAcl){
} catch (NoSuchFileException ex){
throw new RestException(ex,404 , "File doesn't exist", ex.getMessage());
} catch (AccessDeniedException ex){
throw new RestException(ex, 403);
throw new RestException(ex, 403, ex.getMessage());
} catch (IOException ex){
Logger.getLogger(PermissionsResource.class.getName()).log(Level.WARNING, "Unknown exception", ex);
throw new RestException(ex, 500);
Expand Down Expand Up @@ -135,7 +135,7 @@ public Response mergeAcl(List<AclEntryProxy> proxyAcl){
} catch (NoSuchFileException ex){
throw new RestException(ex,404 , "File doesn't exist", ex.getMessage());
} catch (AccessDeniedException ex){
throw new RestException(ex, 403);
throw new RestException(ex, 403, ex.getMessage());
} catch (IOException ex){
Logger.getLogger(PermissionsResource.class.getName()).log(Level.WARNING, "Unknown exception", ex);
throw new RestException(ex, 500);
Expand Down

0 comments on commit 34e720f

Please sign in to comment.