aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2017-08-24 12:56:30 +0000
committerGerrit Code Review <gerrit@onap.org>2017-08-24 12:56:30 +0000
commitcbc5914ca2c1770797f6ad2a05ea9d7c30a55b63 (patch)
treebcfd28417d7f0bca11383bba46c3ed4b372a70c4 /ONAP-PAP-REST
parent6f2b3f2dd0e80895acd0f77aa5784e717be33696 (diff)
parentd3b395408111f444da77eb8b1db8b5e008a287de (diff)
Merge "Fix critical sonar for ONAP-PAP-REST"
Diffstat (limited to 'ONAP-PAP-REST')
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/XACMLPapServlet.java4
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicy.java2
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java7
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java3
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java2
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java9
6 files changed, 15 insertions, 12 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/XACMLPapServlet.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/XACMLPapServlet.java
index e11538c4e..f4c06c37e 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/XACMLPapServlet.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/XACMLPapServlet.java
@@ -1092,7 +1092,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
String message = "DELETE interface called for PAP " + papResourceName + " but it has an Administrative"
+ " state of " + im.getStateManager().getAdminState()
+ "\n Exception Message: " + ae.getMessage();
- LOGGER.info(message);
+ LOGGER.info(message, ae);
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
loggingContext.transactionEnded();
PolicyLogger.audit("Transaction Failed - See Error.log");
@@ -1102,7 +1102,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
String message = "PUT interface called for PAP " + papResourceName + " but it has a Standby Status"
+ " of " + im.getStateManager().getStandbyStatus()
+ "\n Exception Message: " + se.getMessage();
- LOGGER.info(message);
+ LOGGER.info(message, se);
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
loggingContext.transactionEnded();
PolicyLogger.audit("Transaction Failed - See Error.log");
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
index 3355fab85..2a5e9d3dd 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
@@ -76,7 +76,7 @@ public class ClosedLoopPolicy extends Policy {
//Remove the trapMaxAge in Verification Signature
body = body.replace(",\"trapMaxAge\":null", "");
}catch(Exception e){
- LOGGER.debug("No Trap Max Age in JSON body");
+ LOGGER.debug("No Trap Max Age in JSON body", e);
}
this.policyAdapter.setJsonBody(body);
} catch (Exception e) {
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java
index 1b29c0369..02ba2ef14 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/ConfigPolicy.java
@@ -179,11 +179,8 @@ public class ConfigPolicy extends Policy {
XMLReader reader = parser.getXMLReader();
reader.setErrorHandler(new XMLErrorHandler());
reader.parse(new InputSource(new StringReader(data)));
- } catch (ParserConfigurationException e) {
- return false;
- } catch (SAXException e) {
- return false;
- } catch (IOException e) {
+ } catch (ParserConfigurationException | SAXException | IOException e) {
+ LOGGER.debug(e);
return false;
}
return true;
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
index 923e528fa..5abe7ce10 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
@@ -231,6 +231,7 @@ public class CreateBrmsParamPolicy extends Policy {
line = line.split("\\/\\*")[0]
+ line.split("\\*\\/")[1].replace("*/", "");
} catch (Exception e) {
+ LOGGER.debug(e);
line = line.split("\\/\\*")[0];
}
} else {
@@ -242,6 +243,7 @@ public class CreateBrmsParamPolicy extends Policy {
try {
line = line.split("\\*\\/")[1].replace("*/", "");
} catch (Exception e) {
+ LOGGER.debug(e);
line = "";
}
}
@@ -275,6 +277,7 @@ public class CreateBrmsParamPolicy extends Policy {
try {
nextComponent = components[i + 1];
} catch (Exception e) {
+ LOGGER.debug(e);
nextComponent = components[i];
}
//If the type is of type String then we add the UI Item and type to the map.
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java
index fd9e49c7e..aad70e5dd 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java
@@ -90,7 +90,7 @@ public class CreateNewMicroServiceModel {
File deleteFile = new File(cleanUpFile);
FileUtils.forceDelete(deleteFile);
} catch (IOException e) {
- logger.error("Failed to unzip model file " + randomID);
+ logger.error("Failed to unzip model file " + randomID, e);
}
}else {
tempMap = utils.processEpackage("ExtractDir" + File.separator + randomID+".xmi", MODEL_TYPE.XMI);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
index 98c8137de..d2ed1ad51 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
@@ -212,7 +212,7 @@ public class PolicyDBDao {
} catch(Exception e){
PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Exception querying for other registered PolicyDBDaos");
- logger.warn("List of remote PolicyDBDaos will be empty");
+ logger.warn("List of remote PolicyDBDaos will be empty", e);
}
try{
em.getTransaction().commit();
@@ -220,7 +220,7 @@ public class PolicyDBDao {
try{
em.getTransaction().rollback();
} catch(Exception e2){
-
+ logger.debug("List of remote PolicyDBDaos will be empty", e2);
}
}
em.close();
@@ -500,6 +500,7 @@ public class PolicyDBDao {
ourUrl = splitPapUrlUserPass((String)o)[0];
}catch(Exception e){
ourUrl = o;
+ logger.debug(e);
}
if(o == null){
o = "undefined";
@@ -867,6 +868,7 @@ public class PolicyDBDao {
}
} catch(Exception e){
nameAndVersion[0] = originalPolicyName;
+ logger.debug(e);
}
try{
nameAndVersion[1] = policyName.substring(policyName.lastIndexOf('.')+1);
@@ -875,6 +877,7 @@ public class PolicyDBDao {
}
} catch(Exception e){
nameAndVersion[1] = "1";
+ logger.debug(e);
}
return nameAndVersion;
}
@@ -2795,4 +2798,4 @@ public class PolicyDBDao {
}
}
-} \ No newline at end of file
+}