diff options
author | Driptaroop Das <driptaroop.das@in.ibm.com> | 2019-01-16 15:04:46 +0530 |
---|---|---|
committer | Driptaroop Das <driptaroop.das@in.ibm.com> | 2019-01-16 15:05:01 +0530 |
commit | 7414ce00b2f6fd3905f2f5971dcb79a9314eb764 (patch) | |
tree | 6ff4a1c90edefdde7b049d8e37ea5cca1ed402dd | |
parent | b92962811d8a7ad1cd4a834c6ab018f481dff630 (diff) |
DMaaPWebExceptionMapper - sonar fixes
DMaaPWebExceptionMapper - sonar fixes
Issue-ID: DMAAP-966
Change-Id: Ic917d556650bc3b8612e9927dd0ed53b6050591c
Signed-off-by: Driptaroop Das <driptaroop.das@in.ibm.com>
-rw-r--r-- | src/main/java/org/onap/dmaap/DMaaPWebExceptionMapper.java | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/main/java/org/onap/dmaap/DMaaPWebExceptionMapper.java b/src/main/java/org/onap/dmaap/DMaaPWebExceptionMapper.java index 389fb5c..4e2745b 100644 --- a/src/main/java/org/onap/dmaap/DMaaPWebExceptionMapper.java +++ b/src/main/java/org/onap/dmaap/DMaaPWebExceptionMapper.java @@ -3,6 +3,8 @@ * org.onap.dmaap * ================================================================================ * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * + * Modifications Copyright (C) 2019 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,7 +86,6 @@ public class DMaaPWebExceptionMapper implements ExceptionMapper<WebApplicationEx */ @Override public Response toResponse(WebApplicationException ex) { - //System.out.println("--------------------------------------------------"+ex); LOGGER.info("Reached WebException Mapper"); /** @@ -126,11 +127,8 @@ public class DMaaPWebExceptionMapper implements ExceptionMapper<WebApplicationEx errRes = new ErrorResponse(errCode,dmaapErrCode,errMsg); LOGGER.info(errRes.toString()); - Response response = Response.status(errRes.getHttpStatusCode()).header("exception", + return Response.status(errRes.getHttpStatusCode()).header("exception", errRes.getErrMapperStr()).build(); - - return response; - } /** * UnAuthorized @@ -141,10 +139,8 @@ public class DMaaPWebExceptionMapper implements ExceptionMapper<WebApplicationEx getResponseCode(),msgs.getAuthFailure()); LOGGER.info(errRes.toString()); - Response response = Response.status(errRes.getHttpStatusCode()).header("exception", + return Response.status(errRes.getHttpStatusCode()).header("exception", errRes.getErrMapperStr()).build(); - - return response; } /** * Malformed request @@ -155,10 +151,8 @@ public class DMaaPWebExceptionMapper implements ExceptionMapper<WebApplicationEx getResponseCode(),msgs.getBadRequest()); LOGGER.info(errRes.toString()); - Response response = Response.status(errRes.getHttpStatusCode()).header("exception", + return Response.status(errRes.getHttpStatusCode()).header("exception", errRes.getErrMapperStr()).build(); - - return response; } /** * HTTP Method not allowed @@ -169,10 +163,8 @@ public class DMaaPWebExceptionMapper implements ExceptionMapper<WebApplicationEx getResponseCode(),msgs.getMethodNotAllowed()); LOGGER.info(errRes.toString()); - Response response = Response.status(errRes.getHttpStatusCode()).header("exception", + return Response.status(errRes.getHttpStatusCode()).header("exception", errRes.getErrMapperStr()).build(); - - return response; } /** @@ -184,10 +176,8 @@ public class DMaaPWebExceptionMapper implements ExceptionMapper<WebApplicationEx getResponseCode(),msgs.getServerUnav()); LOGGER.info(errRes.toString()); - Response response = Response.status(errRes.getHttpStatusCode()).header("exception", + return Response.status(errRes.getHttpStatusCode()).header("exception", errRes.getErrMapperStr()).build(); - - return response; } |