diff options
author | Ravindra Bakkamanthala <rb7147@att.com> | 2017-06-05 22:42:02 -0400 |
---|---|---|
committer | Ravindra Bakkamanthala <rb7147@att.com> | 2017-06-07 14:47:34 -0400 |
commit | fc5c07705edc4dcb7083b39116a43844bb6a1490 (patch) | |
tree | ab5c7258197fc776fef8106413704a5f0a829160 /ECOMP-PDP-REST/src/main/java | |
parent | d9007d680d19734d5dc106479784c420236cca4b (diff) |
Fixed the Policy API issues and Bugfixes
Change-Id: I6e8b54442421b6ebd0ff88426fc6e5f3a36b0690
Signed-off-by: Ravindra Bakkamanthala <rb7147@att.com>
Diffstat (limited to 'ECOMP-PDP-REST/src/main/java')
5 files changed, 16 insertions, 6 deletions
diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/PapUrlResolver.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/PapUrlResolver.java index 9d7ebbe6e..924c2b5ff 100644 --- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/PapUrlResolver.java +++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/PapUrlResolver.java @@ -24,7 +24,6 @@ import java.net.URI; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.Arrays; import java.util.Date; import java.util.NoSuchElementException; import java.util.Properties; diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/XACMLPdpLoader.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/XACMLPdpLoader.java index b4433036b..0766ac469 100644 --- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/XACMLPdpLoader.java +++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/XACMLPdpLoader.java @@ -559,7 +559,7 @@ public class XACMLPdpLoader { LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while retrieving policy " + policy + " from URL " - + url.toString() + ", e=" + e); + + url + ", e=" + e); } } papUrls.getNext(); diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PAPServices.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PAPServices.java index fe8c79409..4a705f5c4 100644 --- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PAPServices.java +++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PAPServices.java @@ -490,9 +490,16 @@ public class PAPServices { + connection.getHeaderField("message"); } else if ("addGroupError".equals(connection.getHeaderField("error"))) { response = connection.getHeaderField("message"); + } else if ("validation".equals(connection.getHeaderField("error"))){ + response = XACMLErrorConstants.ERROR_DATA_ISSUE + + "Validation errors during policy engine " + connection.getHeaderField("operation") + + " for " + connection.getHeaderField("service"); } else if ("error".equals(connection.getHeaderField("error"))) { response = XACMLErrorConstants.ERROR_UNKNOWN + "Could not create or update the policy for and unknown reason"; + }else{ + response = XACMLErrorConstants.ERROR_DATA_ISSUE + + "BAD REQUEST: Error occured while attempting perform this operation.. the request may be incorrect."; } LOGGER.error(response); } else { diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PolicyEngineImportService.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PolicyEngineImportService.java index 38a0da32e..2a526f751 100644 --- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PolicyEngineImportService.java +++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PolicyEngineImportService.java @@ -80,10 +80,10 @@ public class PolicyEngineImportService { } private void specialCheck() { - if(importResponse.contains("BAD REQUEST") || importResponse.contains("PE300")){ - status = HttpStatus.BAD_REQUEST; - }else if(importResponse.contains("PE200")){ + if(importResponse==null || importResponse.contains("PE200")){ status = HttpStatus.INTERNAL_SERVER_ERROR; + }else if(importResponse.contains("BAD REQUEST") || importResponse.contains("PE300")){ + status = HttpStatus.BAD_REQUEST; } } diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/config/PDPApiAuth.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/config/PDPApiAuth.java index a5d3adb7a..c4573cc0d 100644 --- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/config/PDPApiAuth.java +++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/config/PDPApiAuth.java @@ -51,6 +51,10 @@ public class PDPApiAuth { private static Long oldModified = null; private static AAFPolicyClient aafClient = null; + private PDPApiAuth(){ + // Private Constructor + } + /* * Set Property by reading the properties File. */ @@ -84,7 +88,7 @@ public class PDPApiAuth { String resource) { try{ String[] userNamePass = PolicyUtils.decodeBasicEncoding(clientEncoding); - if(userNamePass==null){ + if(userNamePass==null || userNamePass.length==0){ String usernameAndPassword = null; byte[] decodedBytes = Base64.getDecoder().decode(clientEncoding); usernameAndPassword = new String(decodedBytes, "UTF-8"); |