diff options
Diffstat (limited to 'controlloop/templates/template.demo.clc/src')
2 files changed, 13 insertions, 14 deletions
diff --git a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java index 7abf38620..c75c8a0b7 100644 --- a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java +++ b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java @@ -151,7 +151,7 @@ public class CallGuardTaskEmbedded implements Runnable { // // Create an artificial Guard response in case we didn't get a clear Permit or Deny // - if (guardResponse.getResult().equals("Indeterminate")) { + if ("Indeterminate".equals(guardResponse.getResult())) { guardResponse.setOperation(recipe); guardResponse.setRequestID(UUID.fromString(requestId)); } diff --git a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java index e14946274..64fb70bbd 100644 --- a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java +++ b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java @@ -60,9 +60,14 @@ public class PolicyGuardXacmlHelperEmbedded { private static final Logger netLogger = LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER); - // Constant for the systme line separator + // Constant for the system line separator private static final String SYSTEM_LS = System.lineSeparator(); - private static String propfile; + private String propfile; + private UrlEntry[] restUrls = null; + private int restUrlIndex = 0; + + // REST timeout, initialized from 'pdpx.timeout' property + private int timeout = 20000; public PolicyGuardXacmlHelperEmbedded() { init(PolicyEngine.manager.getEnvironment()); @@ -82,12 +87,6 @@ public class PolicyGuardXacmlHelperEmbedded { String environment = null; } - private UrlEntry[] restUrls = null; - private int restUrlIndex = 0; - - // REST timeout, initialized from 'pdpx.timeout' property - private int timeout = 20000; - /** * Call PDP. * @@ -133,7 +132,7 @@ public class PolicyGuardXacmlHelperEmbedded { urlEntry.authorization, urlEntry.clientAuth, urlEntry.environment); netLogger.info("[IN|{}|{}|]{}{}", "GUARD", urlEntry.restUrl, SYSTEM_LS, response); } catch (Exception e) { - logger.error("Error in sending RESTful request: ", e); + logger.error("Error in sending RESTful request", e); } return response; @@ -235,7 +234,7 @@ public class PolicyGuardXacmlHelperEmbedded { * @param xacmlReq the XACML request * @return the response */ - public static String callEmbeddedPdp(PolicyGuardXacmlRequestAttributes xacmlReq) { + public String callEmbeddedPdp(PolicyGuardXacmlRequestAttributes xacmlReq) { com.att.research.xacml.api.Response response = null; Properties props = new Properties(); // @@ -246,7 +245,7 @@ public class PolicyGuardXacmlHelperEmbedded { BufferedReader br = new BufferedReader(isr) ) { props.load(br); } catch (Exception e) { - logger.error("Unable to load properties file {} {}", propfile, e.getMessage()); + logger.error("Unable to load properties file {}", propfile, e); } // // Create embedded PDPEngine @@ -255,7 +254,7 @@ public class PolicyGuardXacmlHelperEmbedded { try { xacmlPdpEngine = ATTPDPEngineFactory.newInstance().newEngine(props); } catch (Exception e) { - logger.error("Failed to create new PDPEngine {}", e.getMessage()); + logger.error("callEmbeddedPdpEngine failed to create new PDPEngine", e); return null; } logger.debug("embedded Engine created"); @@ -269,7 +268,7 @@ public class PolicyGuardXacmlHelperEmbedded { try { response = xacmlPdpEngine.decide(RequestParser.parseRequest(xacmlReq)); } catch (Exception e) { - logger.error(e.getMessage(), e); + logger.error("callEmbeddedPdpEngine failed on decide", e); } long timeEnd = System.currentTimeMillis(); logger.debug("Elapsed Time: {} ms", (timeEnd - timeStart)); |