Reduce technical debt
[policy/engine.git] / POLICY-SDK-APP / src / main / java / org / onap / policy / controller / DashboardController.java
index aedb943..6679b89 100644 (file)
@@ -45,29 +45,28 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.json.JSONObject;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
 import org.onap.policy.dao.SystemLogDbDao;
 import org.onap.policy.model.PDPGroupContainer;
 import org.onap.policy.rest.XACMLRestProperties;
 import org.onap.policy.rest.dao.CommonClassDao;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.onap.policy.xacml.api.XACMLErrorConstants;
+import org.onap.policy.xacml.api.pap.OnapPDP;
+import org.onap.policy.xacml.api.pap.OnapPDPGroup;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.JsonMessage;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 
-import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
-import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
-import org.onap.policy.xacml.api.XACMLErrorConstants;
-import org.onap.policy.xacml.api.pap.OnapPDP;
-import org.onap.policy.xacml.api.pap.OnapPDPGroup;
-
 import com.att.research.xacml.api.pap.PAPException;
 import com.att.research.xacml.api.pap.PDP;
 import com.att.research.xacml.api.pap.PDPGroup;
 import com.att.research.xacml.api.pap.PDPPolicy;
 import com.att.research.xacml.util.XACMLProperties;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
 import com.fasterxml.jackson.annotation.PropertyAccessor;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
@@ -195,7 +194,6 @@ public class DashboardController  extends RestrictedBaseController{
                        PolicyController controller = getPolicyControllerInstance();
                        Set<OnapPDPGroup> groups = controller.getPapEngine().getOnapPDPGroups();
                        if (groups == null) {
-                               papStatus = "UNKNOWN";
                                throw new PAPException("PAP not running");
                        }else {
                                papStatus = "IS_OK";
@@ -282,8 +280,7 @@ public class DashboardController  extends RestrictedBaseController{
        private long getRequestCounts(String host, int port, String jmxAttribute) {
 
                policyLogger.debug("Create an RMI connector client and connect it to the JMX connector server");
-               HashMap map = new HashMap();
-               map = null;
+               HashMap map = null;
                JMXConnector jmxConnection;
                try {
                        jmxConnection = JMXConnectorFactory.newJMXConnector(createConnectionURL(host, port), map);
@@ -384,8 +381,7 @@ public class DashboardController  extends RestrictedBaseController{
        @SuppressWarnings({ "rawtypes", "unchecked" })
        private Object getPolicy(String host, int port, String jmxAttribute){
                policyLogger.debug("Create an RMI connector client and connect it to the JMX connector server for Policy: " + host);
-               HashMap map = new HashMap();
-               map = null;
+               HashMap map = null;
                JMXConnector jmxConnection;
                try {
                        jmxConnection = JMXConnectorFactory.newJMXConnector(createConnectionURL(host, port), map);
@@ -416,16 +412,15 @@ public class DashboardController  extends RestrictedBaseController{
        }
 
        private static String urnPolicyID(String line){
-               String[]  splitLine = line.toString().split("=");
+               String[]  splitLine = line.split("=");
                String removeSpaces = splitLine[0].replaceAll("\\s+", "");
                return removeSpaces.replace("{", "");
        }
 
        private static Integer countPolicyID(String line){
-               String[]  splitLine = line.toString().split("=");
+               String[]  splitLine = line.split("=");
                String sCount = splitLine[1].replace("}", "");
-               int intCount = Integer.parseInt(sCount);
-               return intCount;
+               return Integer.parseInt(sCount);
        }
 
 }