Skip to content

Commit

Permalink
Simplify the "Payload is empty" handling code
Browse files Browse the repository at this point in the history
  • Loading branch information
tsegismont committed Mar 13, 2015
1 parent bbef7bd commit 63f5e00
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
import org.hawkular.metrics.core.impl.request.TagRequest;

import com.google.common.base.Function;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
Expand Down Expand Up @@ -151,10 +150,7 @@ public void createAvailabilityMetric(@Suspended final AsyncResponse asyncRespons
@Context UriInfo uriInfo
) {
if (metric == null) {
Response response = Response.status(Status.BAD_REQUEST)
.entity(ImmutableMap.of("errorMsg", "Payload is empty"))
.type(APPLICATION_JSON_TYPE)
.build();
Response response = Response.status(Status.BAD_REQUEST).entity(new ApiError("Payload is empty")).build();
asyncResponse.resume(response);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ public void createTenant(
@Context UriInfo uriInfo
) {
if (params == null) {
Response response = Response.status(Status.BAD_REQUEST)
.entity(new ApiError("Payload is empty"))
.type(APPLICATION_JSON_TYPE)
.build();
Response response = Response.status(Status.BAD_REQUEST).entity(new ApiError("Payload is empty")).build();
asyncResponse.resume(response);
return;
}
Expand Down

0 comments on commit 63f5e00

Please sign in to comment.