Merge "Addressing Technical Debt for ONAP-XACML"
[policy/engine.git] / POLICY-SDK-APP / src / main / java / org / onap / policy / utils / XACMLPolicyWriterWithPapNotify.java
index f3e72cb..cbcf062 100644 (file)
@@ -56,6 +56,10 @@ import org.onap.policy.common.logging.flexlogger.Logger;
  */
 public class XACMLPolicyWriterWithPapNotify{
        private static final Logger LOGGER = FlexLogger.getLogger(XACMLPolicyWriterWithPapNotify.class);
+       
+       private XACMLPolicyWriterWithPapNotify() {
+               // Add private constructor to hide the implicit public one
+       }
 
        /**
         * Helper static class that does the work to write a policy set to a file on disk and notify PAP
@@ -206,7 +210,7 @@ public class XACMLPolicyWriterWithPapNotify{
                }
                Base64.Encoder encoder = Base64.getEncoder();
                String encoding = encoder.encodeToString((XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_USERID)+":"+XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_PASS)).getBytes(StandardCharsets.UTF_8));
-               HttpURLConnection connection = null;
+               HttpURLConnection connection;
                UUID requestID = UUID.randomUUID();
                URL url;
                try {
@@ -293,10 +297,8 @@ public class XACMLPolicyWriterWithPapNotify{
        public static boolean notifyPapOfDelete(String policyToDelete){
                Base64.Encoder encoder = Base64.getEncoder();
                String encoding = encoder.encodeToString((XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_USERID)+":"+XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_PASS)).getBytes(StandardCharsets.UTF_8));
-               HttpURLConnection connection = null;
+               HttpURLConnection connection;
                UUID requestID = UUID.randomUUID();
-               //loggingContext.setRequestID(requestID.toString());
-               //loggingContext.transactionStarted();
                String papUrl = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL);
                if(papUrl == null){
                        LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + 
@@ -395,10 +397,8 @@ public class XACMLPolicyWriterWithPapNotify{
                }
                Base64.Encoder encoder = Base64.getEncoder();
                String encoding = encoder.encodeToString((XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_USERID)+":"+XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_PASS)).getBytes(StandardCharsets.UTF_8));
-               HttpURLConnection connection = null;
+               HttpURLConnection connection;
                UUID requestID = UUID.randomUUID();
-               //loggingContext.setRequestID(requestID.toString());
-               //loggingContext.transactionStarted();
                URL url;
                try {
                        url = new URL(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL)+"?policyToCreateUpdate="+ URLEncoder.encode(policyToCreateUpdate, "UTF-8"));