Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MH-13074, Clean up asset manager REST endpoints #410

Merged

Conversation

lkiesow
Copy link
Member

@lkiesow lkiesow commented Sep 3, 2018

The asset manager REST endpoints contains a few pieces of weird or
duplicated code:

  • Remove Entwine's functional library for exception handling
  • Do not duplicate identical methods
  • Remove broken “If-None-Match” header parameter

The asset manager REST endpoints contains a few pieces of weird or
duplicated code:

- Remove Entwine's functional library for exception handling
- Do not duplicate identical methods
- Remove broken “If-None-Match” header parameter
@lkiesow lkiesow added the maintenance This pull request is addressing maintenance issues label Sep 3, 2018
return noContent();
}
});
return snapshot(mediaPackage);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is identical to snapshot anyway

@HeaderParam("If-None-Match") final String ifNoneMatch) {
return handleException(new P1Lazy<Response>() {
@Override public Response get1() {
if (StringUtils.isNotBlank(ifNoneMatch)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is undocumented and makes no sense at all

}

throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
public static Response handleException(Exception e) {
Copy link
Member Author

@lkiesow lkiesow Sep 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This non-functional programming approach is actually shorter, arguably easier to read and does not require Entwine's functional library

@gregorydlogan gregorydlogan self-assigned this Sep 5, 2018
} else
return notFound();
if (StringUtils.isEmpty(mediaPackageId)) {
return notFound();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, shouldn't this be badRequest()? Nevermind, it's the same (incorrect) behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance This pull request is addressing maintenance issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants