aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/music/exceptions/MusicExceptionMapper.java
diff options
context:
space:
mode:
authorNelson, Thomas (arthurdent3) <nelson24@att.com>2019-05-28 04:18:08 +0000
committerNelson, Thomas (arthurdent3) <nelson24@att.com>2019-05-28 04:18:08 +0000
commit9943f1e32b2db7f40ec77243ea235c889eded8f9 (patch)
treef9b69bb030e63c17d6472bd654c8a9275a2072d7 /src/main/java/org/onap/music/exceptions/MusicExceptionMapper.java
parent641255c612fae09ff8840124eb7dcf5046083dd0 (diff)
Bug Fix for Empty Body.
Updated a few missing checks for this. Update api name, add properties to be more forgiving for lock type Change-Id: I4743110bdc654e4346052bd0e045270fd4925417 Issue-ID: MUSIC-398 Signed-off-by: Nelson, Thomas (arthurdent3) <nelson24@att.com>
Diffstat (limited to 'src/main/java/org/onap/music/exceptions/MusicExceptionMapper.java')
-rw-r--r--src/main/java/org/onap/music/exceptions/MusicExceptionMapper.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/main/java/org/onap/music/exceptions/MusicExceptionMapper.java b/src/main/java/org/onap/music/exceptions/MusicExceptionMapper.java
index 83bb1b8a..c31fcf73 100644
--- a/src/main/java/org/onap/music/exceptions/MusicExceptionMapper.java
+++ b/src/main/java/org/onap/music/exceptions/MusicExceptionMapper.java
@@ -37,18 +37,20 @@ public class MusicExceptionMapper implements ExceptionMapper<Exception> {
public Response toResponse(Exception exception) {
if(exception instanceof UnrecognizedPropertyException) {
return Response.status(Response.Status.BAD_REQUEST).
- entity(new JsonResponse(ResultType.FAILURE).setError("Unknown field :"+((UnrecognizedPropertyException) exception).getUnrecognizedPropertyName()).toMap()).
- build();
- }
- else if(exception instanceof EOFException) {
+ entity(new JsonResponse(ResultType.FAILURE).setError("Unknown field :"+((UnrecognizedPropertyException) exception).getUnrecognizedPropertyName()).toMap()).
+ build();
+ } else if(exception instanceof EOFException) {
return Response.status(Response.Status.BAD_REQUEST).
- entity(new JsonResponse(ResultType.FAILURE).setError("Request body cannot be empty").toMap()).
- build();
- }
- else {
+ entity(new JsonResponse(ResultType.FAILURE).setError("Request body cannot be empty").toMap()).
+ build();
+ } else if(exception instanceof NullPointerException) {
+ return Response.status(Response.Status.BAD_REQUEST).
+ entity(new JsonResponse(ResultType.FAILURE).setError("NullPointerException - Please check to make sure all inputs are valid.").toMap()).
+ build();
+ } else {
return Response.status(Response.Status.BAD_REQUEST).
- entity(new JsonResponse(ResultType.FAILURE).setError(exception.getMessage()).toMap()).
- build();
+ entity(new JsonResponse(ResultType.FAILURE).setError(exception.getMessage()).toMap()).
+ build();
}
}
}