X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ECOMP-PDP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fpdp%2Frest%2Fapi%2Fservices%2FGetDictionaryService.java;h=04567e2e1978effb2b9cd5e9706b567052a4f3d9;hb=4ca818fdfb9b807562166800a086b413593d6894;hp=2305ecbec3de4e1b593bf76484d92b48d4310243;hpb=e0addf5b588a1244f9679becd90999dfcb4c3a94;p=policy%2Fengine.git diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetDictionaryService.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetDictionaryService.java index 2305ecbec..04567e2e1 100644 --- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetDictionaryService.java +++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetDictionaryService.java @@ -35,7 +35,7 @@ import org.openecomp.policy.xacml.api.XACMLErrorConstants; import org.springframework.http.HttpStatus; public class GetDictionaryService { - private static Logger LOGGER = FlexLogger.getLogger(GetDictionaryService.class.getName()); + private static final Logger LOGGER = FlexLogger.getLogger(GetDictionaryService.class.getName()); private DictionaryResponse dictionaryResponse = null; private HttpStatus status = HttpStatus.BAD_REQUEST; @@ -52,7 +52,7 @@ public class GetDictionaryService { requestUUID = UUID.fromString(requestID); } catch (IllegalArgumentException e) { requestUUID = UUID.randomUUID(); - LOGGER.info("Generated Random UUID: " + requestUUID.toString()); + LOGGER.info("Generated Random UUID: " + requestUUID.toString(), e); } }else{ requestUUID = UUID.randomUUID(); @@ -72,10 +72,8 @@ public class GetDictionaryService { } private void specialCheck() { - if(dictionaryResponse!=null){ - if(dictionaryResponse.getResponseMessage()!=null && dictionaryResponse.getResponseMessage().contains("PE300")){ - status = HttpStatus.BAD_REQUEST; - } + if(dictionaryResponse!=null && (dictionaryResponse.getResponseMessage()!=null && dictionaryResponse.getResponseMessage().contains("PE300"))){ + status = HttpStatus.BAD_REQUEST; } } @@ -115,7 +113,7 @@ public class GetDictionaryService { json = PolicyApiUtils.stringToJsonObject(datas); } catch(JsonException| IllegalStateException e){ message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " improper Dictionary JSON object : " + dictionaryParameters.getDictionaryJson(); - LOGGER.error(message); + LOGGER.error(message, e); response.setResponseMessage(message); response.setResponseCode(400); return response; @@ -126,6 +124,11 @@ public class GetDictionaryService { } else { response.setResponseCode(400); response.setResponseMessage(result); + if(result!=null && result.contains("PE200")){ + status=HttpStatus.INTERNAL_SERVER_ERROR; + }else{ + status=HttpStatus.BAD_REQUEST; + } } return response; }