aboutsummaryrefslogtreecommitdiffstats
path: root/datarouter-prov/src/main/java/org
diff options
context:
space:
mode:
authoreconwar <conor.ward@est.tech>2019-05-14 15:16:56 +0000
committereconwar <conor.ward@est.tech>2019-05-14 15:16:56 +0000
commit6125df9402379605e28188c61433eaf75930102d (patch)
treeb3a2cc0ddf1d469d8e3d158a93eeec803936624a /datarouter-prov/src/main/java/org
parent15b5a700e4d2ea3572d38ccf1a8120040e23a038 (diff)
Remove critical code smells for servlet classes
Change-Id: I691787741b84de630cbd80c4c887c89c99f662f5 Issue-ID: DMAAP-1195 Signed-off-by: econwar <conor.ward@est.tech>
Diffstat (limited to 'datarouter-prov/src/main/java/org')
-rwxr-xr-xdatarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java38
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java8
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java8
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java10
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/InternalServlet.java17
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java2
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java10
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Poker.java6
-rwxr-xr-xdatarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/ProxyServlet.java10
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/PublishServlet.java3
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/RouteServlet.java14
-rwxr-xr-xdatarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/StatisticsServlet.java25
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java6
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java14
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java14
15 files changed, 90 insertions, 95 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java
index deb78b16..66a7c360 100755
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java
@@ -287,7 +287,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
loopback = InetAddress.getLoopbackAddress();
//checkHttpsRelaxation(); //Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047.
} catch (UnknownHostException e) {
- // ignore
+ intlogger.info("BaseServlet.init: " + e.getMessage(), e);
}
}
@@ -380,7 +380,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
return "Unauthorized address: " + remote;
}
} catch (UnknownHostException e) {
- intlogger.error("PROV0051 BaseServlet.isAuthorizedForProvisioning: ", e.getMessage());
+ intlogger.error("PROV0051 BaseServlet.isAuthorizedForProvisioning: " + e.getMessage(), e);
return "Unauthorized address: " + remote;
}
// Does remote have a valid certificate?
@@ -429,7 +429,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
return true;
}
} catch (UnknownHostException e) {
- intlogger.error("PROV0052 BaseServlet.isAuthorizedForInternal: ", e.getMessage());
+ intlogger.error("PROV0052 BaseServlet.isAuthorizedForInternal: " + e.getMessage(), e);
}
return false;
}
@@ -473,7 +473,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
}
}
} catch (UnknownHostException e) {
- intlogger.error("PROV0053 BaseServlet.addressMatchesNetwork: ", e.getMessage());
+ intlogger.error("PROV0053 BaseServlet.addressMatchesNetwork: " + e.getMessage(), e);
return false;
}
return true;
@@ -519,7 +519,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
thisPod = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
thisPod = "";
- intlogger.warn("PROV0014 Cannot determine the name of this provisioning server.");
+ intlogger.warn("PROV0014 Cannot determine the name of this provisioning server.", e);
}
// Normalize the nodes, and fill in nodeAddresses
@@ -530,7 +530,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
intlogger.debug("PROV0003 DNS lookup: " + nodes[i] + " => " + na[i].toString());
} catch (UnknownHostException e) {
na[i] = null;
- intlogger.warn("PROV0004 Cannot lookup " + nodes[i] + ": " + e.getMessage());
+ intlogger.warn("PROV0004 Cannot lookup " + nodes[i] + ": " + e.getMessage(), e);
}
}
@@ -558,7 +558,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
intlogger.debug("PROV0003 DNS lookup: " + pods[i] + " => " + na[i].toString());
} catch (UnknownHostException e) {
na[i] = null;
- intlogger.warn("PROV0004 Cannot lookup " + pods[i] + ": " + e.getMessage());
+ intlogger.warn("PROV0004 Cannot lookup " + pods[i] + ": " + e.getMessage(), e);
}
}
podAddresses = na;
@@ -584,7 +584,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
try (InputStream inStream = getClass().getClassLoader().getResourceAsStream(MAILCONFIG_FILE)) {
mailprops.load(inStream);
} catch (IOException e) {
- intlogger.error("PROV9003 Opening properties: " + e.getMessage());
+ intlogger.error("PROV9003 Opening properties: " + e.getMessage(), e);
System.exit(1);
}
}
@@ -604,7 +604,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
try {
notifyPSTeam(p.get("org.onap.dmaap.datarouter.provserver.https.relax.notify").toString());
} catch (Exception e) {
- intlogger.warn("Exception: " + e.getMessage());
+ intlogger.warn("Exception: " + e.getMessage(), e);
}
}
mailSendFlag = true;
@@ -617,7 +617,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
* @param email - list of email ids to notify if HTTP relexcation is enabled.
* @author vs215k
**/
- private void notifyPSTeam(String email) throws Exception {
+ private void notifyPSTeam(String email) {
loadMailProperties(); //Load HTTPS Relex mail properties.
String[] emails = email.split(Pattern.quote("|"));
@@ -653,7 +653,9 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
intlogger.info("HTTPS relaxation mail is sent to - : " + email);
} catch (MessagingException e) {
- intlogger.error("Invalid email address, unable to send https relaxation mail to - : " + email);
+ intlogger.error("Invalid email address, unable to send https relaxation mail to - : " + email, e);
+ } catch (UnknownHostException uhe) {
+ intlogger.error("UnknownHostException", uhe);
}
}
@@ -748,7 +750,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
rv = bean.doInsert(conn);
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0005 doInsert: " + e.getMessage());
+ intlogger.warn("PROV0005 doInsert: " + e.getMessage(), e);
} finally {
if (conn != null) {
db.release(conn);
@@ -772,7 +774,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
rv = bean.doUpdate(conn);
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0006 doUpdate: " + e.getMessage());
+ intlogger.warn("PROV0006 doUpdate: " + e.getMessage(), e);
} finally {
if (conn != null) {
db.release(conn);
@@ -796,7 +798,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
rv = bean.doDelete(conn);
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0007 doDelete: " + e.getMessage());
+ intlogger.warn("PROV0007 doDelete: " + e.getMessage(), e);
} finally {
if (conn != null) {
db.release(conn);
@@ -959,7 +961,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
return true;
}
} catch (JSONException e) {
- intlogger.error("JSONException: " + e.getMessage());
+ intlogger.error("JSONException: " + e.getMessage(), e);
}
}
return false;
@@ -1048,7 +1050,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());
MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
} catch (Exception e) {
- intlogger.error("Exception: " + e.getMessage());
+ intlogger.error("Exception: " + e.getMessage(), e);
}
}
@@ -1091,7 +1093,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
}
return type + "|" + aafInstance + "|" + action;
} catch (Exception e) {
- intlogger.error("PROV7005 BaseServlet.getFeedPermission: ", e.getMessage());
+ intlogger.error("PROV7005 BaseServlet.getFeedPermission: " + e.getMessage(), e);
}
return null;
}
@@ -1139,7 +1141,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
}
return type + "|" + aafInstance + "|" + action;
} catch (Exception e) {
- intlogger.error("PROV7005 BaseServlet.getSubscriberPermission: ", e.getMessage());
+ intlogger.error("PROV7005 BaseServlet.getSubscriberPermission: " + e.getMessage(), e);
}
return null;
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java
index 86e0268d..058c7621 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java
@@ -150,7 +150,7 @@ public class DRFeedsServlet extends ProxyServlet {
try {
resp.getOutputStream().print(feed.asJSONObject(true).toString());
} catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
+ eventlogger.error("PROV0111 DRFeedServlet.doGet " + ioe.getMessage(), ioe);
}
}
} else {
@@ -174,7 +174,7 @@ public class DRFeedsServlet extends ProxyServlet {
try {
resp.getOutputStream().print(t);
} catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
+ eventlogger.error("PROV0112 DRFeedServlet.doGet " + ioe.getMessage(), ioe);
}
}
} finally {
@@ -283,7 +283,7 @@ public class DRFeedsServlet extends ProxyServlet {
message = e.getMessage();
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.error(elr.toString());
+ eventlogger.error(elr.toString(), e);
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -365,7 +365,7 @@ public class DRFeedsServlet extends ProxyServlet {
try {
resp.getOutputStream().print(feed.asLimitedJSONObject().toString());
} catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
+ eventlogger.error("PROV0113 DRFeedServlet.doPost " + ioe.getMessage(), ioe);
}
provisioningDataChanged();
} else {
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java
index 3cbaac3c..4fc0b7fa 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java
@@ -227,7 +227,7 @@ public class FeedServlet extends ProxyServlet {
try {
resp.getOutputStream().print(feed.asJSONObject(true).toString());
} catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
+ eventlogger.error("PROV0101 FeedServlet.doGet: " + ioe.getMessage(), ioe);
}
} finally {
eelfLogger.info(EelfMsgs.EXIT);
@@ -313,7 +313,7 @@ public class FeedServlet extends ProxyServlet {
message = e.getMessage();
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.error(elr.toString());
+ eventlogger.error(elr.toString(), e);
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -392,7 +392,7 @@ public class FeedServlet extends ProxyServlet {
try {
resp.getOutputStream().print(feed.asLimitedJSONObject().toString());
} catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
+ eventlogger.error("PROV0102 FeedServlet.doPut: " + ioe.getMessage(), ioe);
}
@@ -405,7 +405,7 @@ public class FeedServlet extends ProxyServlet {
feed.changeOwnerShip();
}
} catch (JSONException je) {
- eventlogger.error("JSONException" + je.getMessage());
+ eventlogger.error("PROV0103 FeedServlet.doPut: " + je.getMessage(), je);
}
}
/***End of change ownership*/
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java
index 188dce61..5cd54811 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java
@@ -132,7 +132,7 @@ public class GroupServlet extends ProxyServlet {
try {
resp.getOutputStream().print(gup.asJSONObject().toString());
} catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
+ eventlogger.error("PROV0121 GroupServlet.doGet: " + ioe.getMessage(), ioe);
}
// Display a list of Groups
@@ -230,7 +230,7 @@ public class GroupServlet extends ProxyServlet {
message = e.getMessage();
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.error(elr.toString());
+ eventlogger.error(elr.toString(), e);
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -253,7 +253,7 @@ public class GroupServlet extends ProxyServlet {
try {
resp.getOutputStream().print(gup.asJSONObject().toString());
} catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
+ eventlogger.error("PROV0122 GroupServlet.doPut: " + ioe.getMessage(), ioe);
}
provisioningDataChanged();
} else {
@@ -352,7 +352,7 @@ public class GroupServlet extends ProxyServlet {
message = e.getMessage();
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.error(elr.toString());
+ eventlogger.error(elr.toString(), e);
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -379,7 +379,7 @@ public class GroupServlet extends ProxyServlet {
try {
resp.getOutputStream().print(gup.asJSONObject().toString());
} catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
+ eventlogger.error("PROV0122 GroupServlet.doPost: " + ioe.getMessage(), ioe);
}
provisioningDataChanged();
} else {
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/InternalServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/InternalServlet.java
index 56b40e04..005acadb 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/InternalServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/InternalServlet.java
@@ -268,7 +268,7 @@ public class InternalServlet extends ProxyServlet {
try {
resp.getOutputStream().print(p.getProvisioningString());
} catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
+ intlogger.error("PROV0131 InternalServlet.doGet: " + ioe.getMessage(), ioe);
}
return;
}
@@ -278,7 +278,7 @@ public class InternalServlet extends ProxyServlet {
try {
resp.getOutputStream().print(generateLogfileList().toString());
} catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
+ intlogger.error("PROV0132 InternalServlet.doGet: " + ioe.getMessage(), ioe);
}
return;
}
@@ -294,7 +294,7 @@ public class InternalServlet extends ProxyServlet {
try {
Files.copy(logpath, resp.getOutputStream());
} catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
+ intlogger.error("PROV0133 InternalServlet.doGet: " + ioe.getMessage(), ioe);
}
return;
}
@@ -316,7 +316,7 @@ public class InternalServlet extends ProxyServlet {
try {
resp.getOutputStream().print(param.getValue() + "\n");
} catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
+ intlogger.error("PROV0134 InternalServlet.doGet: " + ioe.getMessage(), ioe);
}
return;
}
@@ -330,7 +330,7 @@ public class InternalServlet extends ProxyServlet {
try {
resp.getOutputStream().print(lfl.getBitSet().toString());
} catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
+ intlogger.error("PROV0135 InternalServlet.doGet: " + ioe.getMessage(), ioe);
}
return;
}
@@ -477,12 +477,13 @@ public class InternalServlet extends ProxyServlet {
total += store.getTotalSpace();
avail += store.getUsableSpace();
} catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
+ intlogger.error("PROV0136 InternalServlet.doPost: " + ioe.getMessage(), ioe);
}
}
try {
fs.close();
} catch (Exception e) {
+ intlogger.error("PROV0137 InternalServlet.doPost: " + e.getMessage(), e);
}
if (((avail * 100) / total) < 5) {
elr.setResult(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
@@ -500,7 +501,7 @@ public class InternalServlet extends ProxyServlet {
eventlogger.info(elr.toString());
LogfileLoader.getLoader(); // This starts the logfile loader "task"
} catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
+ intlogger.error("PROV0138 InternalServlet.doPost: " + ioe.getMessage(), ioe);
}
return;
}
@@ -529,7 +530,7 @@ public class InternalServlet extends ProxyServlet {
LogRecord.printLogRecords(resp.getOutputStream(), bs);
eventlogger.info(elr.toString());
} catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
+ intlogger.error("PROV0139 InternalServlet.doPost: " + ioe.getMessage(), ioe);
}
return;
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java
index 77bcbddc..74441dac 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java
@@ -226,7 +226,7 @@ public class LogServlet extends BaseServlet {
}
out.print("]");
} catch (IOException ioe) {
- eventlogger.error("IOException: " + ioe.getMessage());
+ eventlogger.error("PROV0141 LogServlet.doGet: " + ioe.getMessage(), ioe);
}
} finally {
eelfLogger.info(EelfMsgs.EXIT);
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java
index a0d8664f..7c693bd2 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java
@@ -102,7 +102,7 @@ public class Main {
try {
in = getClass().getClassLoader().getResourceAsStream("drProvCadi.properties");
} catch (Exception e) {
- intlogger.error("Exception in Main.getCadiProps() method ", e.getMessage());
+ intlogger.error("Exception in Main.getCadiProps(): " + e.getMessage(), e);
}
return in;
}
@@ -247,8 +247,8 @@ public class Main {
Inner obj = new Main().new Inner();
InputStream in = obj.getCadiProps();
cadiProperties.load(in);
- } catch (IOException e1) {
- intlogger.error("PROV0001 Exception loading CADI properties", e1.getMessage());
+ } catch (IOException ioe) {
+ intlogger.error("PROV0001 Exception loading CADI properties: " + ioe.getMessage(), ioe);
}
cadiProperties.setProperty("aaf_locate_url", provProperties.getProperty("org.onap.dmaap.datarouter.provserver.cadi.aaf.url", "https://aaf-onap-test.osaaf.org:8095"));
intlogger.info("PROV0001 aaf_url set to - " + cadiProperties.getProperty("aaf_url"));
@@ -281,7 +281,7 @@ public class Main {
server.start();
intlogger.info("Prov Server started-" + server.getState());
} catch (Exception e) {
- intlogger.info("Jetty failed to start. Reporting will we unavailable", e.getMessage());
+ intlogger.info("Jetty failed to start. Reporting will we unavailable: " + e.getMessage(), e);
}
server.join();
intlogger.info("PROV0001 **** AT&T Data Router Provisioning Server halted.");
@@ -302,7 +302,7 @@ public class Main {
Thread.sleep(5000L);
System.exit(0);
} catch (Exception e) {
- intlogger.error("Exception in Main.shutdown() method " + e.getMessage());
+ intlogger.error("Exception in Main.shutdown(): " + e.getMessage(), e);
}
});
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Poker.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Poker.java
index b9d5e7a6..6177df28 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Poker.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Poker.java
@@ -85,7 +85,7 @@ public class Poker extends TimerTask {
thisPod = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
thisPod = "*UNKNOWN*"; // not a major problem
- logger.info("UnknownHostException: Setting thisPod to \"*UNKNOWN*\"");
+ logger.info("UnknownHostException: Setting thisPod to \"*UNKNOWN*\"", e);
}
provString = buildProvisioningString();
@@ -195,10 +195,10 @@ public class Poker extends TimerTask {
} catch (MalformedURLException e) {
logger.warn(
"PROV0013 MalformedURLException Error poking node at " + nodeUrl + " : " + e
- .getMessage());
+ .getMessage(), e);
} catch (IOException e) {
logger.warn("PROV0013 IOException Error poking node at " + nodeUrl + " : " + e
- .getMessage());
+ .getMessage(), e);
}
};
r.run();
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/ProxyServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/ProxyServlet.java
index 67a74de3..96dae255 100755
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/ProxyServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/ProxyServlet.java
@@ -101,7 +101,7 @@ public class ProxyServlet extends BaseServlet {
sch = new Scheme("https", 443, socketFactory);
inited = true;
} catch (Exception e) {
- intlogger.error("ProxyServlet: " + e.getMessage());
+ intlogger.error("ProxyServlet.init: " + e.getMessage(), e);
}
intlogger.info("ProxyServlet: inited = " + inited);
}
@@ -111,7 +111,7 @@ public class ProxyServlet extends BaseServlet {
try (FileInputStream instream = new FileInputStream(new File(store))) {
ks.load(instream, pass.toCharArray());
} catch (FileNotFoundException fileNotFoundException) {
- intlogger.error("ProxyServlet: " + fileNotFoundException.getMessage());
+ intlogger.error("ProxyServlet.readStore: " + fileNotFoundException.getMessage(), fileNotFoundException);
} catch (Exception x) {
intlogger.error("READING TRUSTSTORE: " + x);
}
@@ -211,7 +211,7 @@ public class ProxyServlet extends BaseServlet {
rv = true;
} catch (IOException e) {
- intlogger.error("ProxyServlet: " + e.getMessage());
+ intlogger.error("ProxyServlet.doGetWithFallback: " + e.getMessage(), e);
} finally {
proxy.releaseConnection();
httpclient.getConnectionManager().shutdown();
@@ -250,7 +250,7 @@ public class ProxyServlet extends BaseServlet {
copyResponseHeaders(pxyResponse, resp);
copyEntityContent(pxyResponse, resp);
} catch (IOException e) {
- intlogger.warn("ProxyServlet: " + e.getMessage());
+ intlogger.warn("ProxyServlet.doProxy: " + e.getMessage(), e);
sendResponseError(resp, HttpServletResponse.SC_SERVICE_UNAVAILABLE, "", intlogger);
} finally {
proxy.releaseConnection();
@@ -300,7 +300,7 @@ public class ProxyServlet extends BaseServlet {
try (InputStream in = entity.getContent()) {
IOUtils.copy(in, resp.getOutputStream());
} catch (Exception e) {
- intlogger.error("Exception: " + e.getMessage());
+ intlogger.error("ProxyServlet.copyEntityContent: " + e.getMessage(), e);
}
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/PublishServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/PublishServlet.java
index 76a983f8..2ef5087f 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/PublishServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/PublishServlet.java
@@ -169,7 +169,7 @@ public class PublishServlet extends BaseServlet {
}
}
} catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
+ intlogger.error("PROV0151 PublishServlet.redirect: " + ioe.getMessage(), ioe);
}
}
@@ -235,6 +235,7 @@ public class PublishServlet extends BaseServlet {
}
return -1;
} catch (NumberFormatException | JSONException e) {
+ intlogger.debug("PROV0152 PublishServlet.checkPath: " + e.getMessage(), e);
return -1;
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/RouteServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/RouteServlet.java
index 4dd422a0..176cef55 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/RouteServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/RouteServlet.java
@@ -208,7 +208,9 @@ public class RouteServlet extends ProxyServlet {
);
d = new Deleteable[] { nr };
} catch (IllegalArgumentException e) {
- sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, "The specified network route does not exist.", eventlogger);
+ String message = "The specified network route does not exist.";
+ eventlogger.error(message, e);
+ sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger);
return;
}
} else {
@@ -289,7 +291,7 @@ public class RouteServlet extends ProxyServlet {
try {
sb.append("\"").append(jx.getString(key)).append("\"");
} catch (JSONException je) {
- eventlogger.error("JSONException" + je.getMessage());
+ eventlogger.error("PROV0161 RouteServlet.doGet: " + je.getMessage(), je);
}
pfx = ",\n";
}
@@ -315,7 +317,7 @@ public class RouteServlet extends ProxyServlet {
try {
resp.getOutputStream().print(sb.toString());
} catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
+ eventlogger.error("PROV0162 RouteServlet.doGet: " + ioe.getMessage(), ioe);
}
}
/**
@@ -368,7 +370,7 @@ public class RouteServlet extends ProxyServlet {
int seq = (t != null) ? Integer.parseInt(t) : (IngressRoute.getMaxSequence() + 100);
ins = new Insertable[] { new IngressRoute(seq, feedid, user, subnet, NodeClass.lookupNodeNames(nodepatt)) };
} catch (Exception e) {
- intlogger.info(e.toString());
+ intlogger.info(e.toString(), e);
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, "Invalid arguments in 'add ingress' command.", intlogger);
return;
}
@@ -384,7 +386,7 @@ public class RouteServlet extends ProxyServlet {
String node = NodeClass.normalizeNodename(req.getParameter("node"));
ins = new Insertable[] { new EgressRoute(subid, node) };
} catch (Exception e) {
- intlogger.info(e.toString());
+ intlogger.info(e.toString(), e);
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, "Invalid arguments in 'add egress' command.", intlogger);
return;
}
@@ -410,7 +412,7 @@ public class RouteServlet extends ProxyServlet {
}
ins = new Insertable[] { nr };
} catch (IllegalArgumentException e) {
- intlogger.info(e.toString());
+ intlogger.info(e.toString(), e);
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, "Invalid arguments in 'add network' command.", intlogger);
return;
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/StatisticsServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/StatisticsServlet.java
index 34ba5d34..5fa7e169 100755
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/StatisticsServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/StatisticsServlet.java
@@ -98,7 +98,7 @@ public class StatisticsServlet extends BaseServlet {
try {
resp.getOutputStream().print("Invalid request, Feedid or Group ID is required.");
} catch (IOException ioe) {
- eventlogger.error("IOException: " + ioe.getMessage());
+ eventlogger.error("PROV0171 StatisticsServlet.doGet: " + ioe.getMessage(), ioe);
}
}
@@ -110,35 +110,22 @@ public class StatisticsServlet extends BaseServlet {
StringBuffer groupid1 = new StringBuffer();
try {
- System.out.println("feeedidsssssssss");
groupid1 = this.getFeedIdsByGroupId(Integer.parseInt(req.getParameter("groupid")));
- System.out.println("feeedids" + req.getParameter("groupid"));
-
map.put("feedids", groupid1.toString());
- System.out.println("groupid1" + groupid1.toString());
-
-
} catch (NumberFormatException | SQLException e) {
- eventlogger.error(e.getMessage());
+ eventlogger.error("PROV0172 StatisticsServlet.doGet: " + e.getMessage(), e);
}
}
if (req.getParameter("groupid") != null && req.getParameter("feedid") != null) {
StringBuffer groupid1 = new StringBuffer();
try {
- System.out.println("both r not null");
groupid1 = this.getFeedIdsByGroupId(Integer.parseInt(req.getParameter("groupid")));
- System.out.println("feeedids" + req.getParameter("groupid"));
groupid1.append(",");
groupid1.append(req.getParameter("feedid").replace("|", ",").toString());
-
map.put("feedids", groupid1.toString());
-
- System.out.println("groupid1" + groupid1.toString());
-
-
} catch (NumberFormatException | SQLException e) {
- eventlogger.error(e.getMessage());
+ eventlogger.error("PROV0173 StatisticsServlet.doGet: " + e.getMessage(), e);
}
}
@@ -182,7 +169,7 @@ public class StatisticsServlet extends BaseServlet {
try {
this.getRecordsForSQL(map, outputType, resp.getOutputStream(), resp);
} catch (IOException ioe) {
- eventlogger.error("IOException: " + ioe.getMessage());
+ eventlogger.error("PROV0174 StatisticsServlet.doGet: " + ioe.getMessage(), ioe);
}
}
@@ -291,7 +278,7 @@ public class StatisticsServlet extends BaseServlet {
System.out.println("feedIds" + feedIds.toString());
}
} catch (SQLException e) {
- eventlogger.error(e.getMessage());
+ eventlogger.error("PROV0175 StatisticsServlet.getFeedIdsByGroupId: " + e.getMessage(), e);
} finally {
try {
if (resultSet != null) {
@@ -302,7 +289,7 @@ public class StatisticsServlet extends BaseServlet {
db.release(conn);
}
} catch (Exception e) {
- eventlogger.error(e.getMessage());
+ eventlogger.error("PROV0176 StatisticsServlet.getFeedIdsByGroupId: " + e.getMessage(), e);
}
}
return feedIds;
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java
index 69451a3b..ef3555bc 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java
@@ -140,7 +140,7 @@ public class SubscribeServlet extends ProxyServlet {
try {
resp.getOutputStream().print(t);
} catch (IOException ioe) {
- eventlogger.error("IOException: " + ioe.getMessage());
+ eventlogger.error("PROV0181 SubscribeServlet.doGet: " + ioe.getMessage(), ioe);
}
} finally {
eelfLogger.info(EelfMsgs.EXIT);
@@ -258,7 +258,7 @@ public class SubscribeServlet extends ProxyServlet {
message = e.getMessage();
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.error(elr.toString());
+ eventlogger.error(elr.toString(), e);
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -341,7 +341,7 @@ public class SubscribeServlet extends ProxyServlet {
try {
resp.getOutputStream().print(sub.asLimitedJSONObject().toString());
} catch (IOException ioe) {
- eventlogger.error("IOException: " + ioe.getMessage());
+ eventlogger.error("PROV0182 SubscribeServlet.doPost: " + ioe.getMessage(), ioe);
}
provisioningDataChanged();
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java
index 63ff84de..ff3ed3c1 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java
@@ -233,7 +233,7 @@ public class SubscriptionServlet extends ProxyServlet {
try {
resp.getOutputStream().print(sub.asJSONObject(true).toString());
} catch (IOException ioe) {
- eventlogger.error("IOException: " + ioe.getMessage());
+ eventlogger.error("PROV0191 SubscriptionServlet.doGet: " + ioe.getMessage(), ioe);
}
} finally {
eelfLogger.info(EelfMsgs.EXIT);
@@ -320,7 +320,7 @@ public class SubscriptionServlet extends ProxyServlet {
message = e.getMessage();
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.error(elr.toString());
+ eventlogger.error(elr.toString(), e);
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -380,7 +380,7 @@ public class SubscriptionServlet extends ProxyServlet {
try {
resp.getOutputStream().print(sub.asLimitedJSONObject().toString());
} catch (IOException ioe) {
- eventlogger.error("IOException: " + ioe.getMessage());
+ eventlogger.error("PROV0192 SubscriptionServlet.doPut: " + ioe.getMessage(), ioe);
}
/**Change Owner ship of Subscriber Adding for group feature:Rally US708115*/
@@ -392,7 +392,7 @@ public class SubscriptionServlet extends ProxyServlet {
sub.changeOwnerShip();
}
} catch (JSONException je) {
- eventlogger.error("JSONException: " + je.getMessage());
+ eventlogger.error("PROV0193 SubscriptionServlet.doPut: " + je.getMessage(), je);
}
}
/***End of change ownership*/
@@ -499,7 +499,7 @@ public class SubscriptionServlet extends ProxyServlet {
message = "Badly formed JSON";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.error(elr.toString());
+ eventlogger.error(elr.toString(), e);
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
}
} finally {
@@ -538,11 +538,11 @@ public class SubscriptionServlet extends ProxyServlet {
conn.getContentLength(); // Force the GET through
conn.disconnect();
} catch (IOException e) {
- intlogger.info("IOException Error accessing URL: " + u + ": " + e.getMessage());
+ intlogger.info("PROV0194 Error accessing URL: " + u + ": " + e.getMessage(), e);
}
}
} catch (Exception e) {
- intlogger.warn("Caught exception in SubscriberNotifyThread: " + e.getMessage());
+ intlogger.warn("PROV0195 Caught exception in SubscriberNotifyThread: " + e.getMessage(), e);
}
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java
index 3097a9db..65526453 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java
@@ -312,7 +312,7 @@ public class SynchronizerTask extends TimerTask {
logger.warn("PROV5003: My name (" + thisPod + ") is missing from the list of provisioning servers.");
}
} catch (UnknownHostException e) {
- logger.warn("PROV5002: Cannot determine the name of this provisioning server.");
+ logger.warn("PROV5002: Cannot determine the name of this provisioning server.", e);
}
if (newstate != state) {
@@ -334,7 +334,7 @@ public class SynchronizerTask extends TimerTask {
Feed f = new Feed(ja.getJSONObject(n));
coll.add(f);
} catch (Exception e) {
- logger.warn("PROV5004: Invalid object in feed: " + ja.optJSONObject(n));
+ logger.warn("PROV5004: Invalid object in feed: " + ja.optJSONObject(n), e);
}
}
if (sync(coll, Feed.getAllFeeds())) {
@@ -355,7 +355,7 @@ public class SynchronizerTask extends TimerTask {
Subscription s = new Subscription(j);
coll.add(s);
} catch (Exception e) {
- logger.warn("PROV5004: Invalid object in subscription: " + ja.optJSONObject(n));
+ logger.warn("PROV5004: Invalid object in subscription: " + ja.optJSONObject(n), e);
}
}
if (sync(coll, Subscription.getAllSubscriptions())) {
@@ -373,7 +373,7 @@ public class SynchronizerTask extends TimerTask {
Group g = new Group(ja.getJSONObject(n));
coll.add(g);
} catch (Exception e) {
- logger.warn("PROV5004: Invalid object in subscription: " + ja.optJSONObject(n));
+ logger.warn("PROV5004: Invalid object in group: " + ja.optJSONObject(n), e);
}
}
if (sync(coll, Group.getAllgroups())) {
@@ -392,9 +392,11 @@ public class SynchronizerTask extends TimerTask {
try {
v = jo.getString(k);
} catch (JSONException e) {
+ logger.warn("PROV5004: Invalid object in parameters: " + jo.optJSONObject(k), e);
try {
v = "" + jo.getInt(k);
} catch (JSONException e1) {
+ logger.warn("PROV5004: Invalid object in parameters: " + jo.optInt(k), e);
JSONArray ja = jo.getJSONArray(k);
for (int i = 0; i < ja.length(); i++) {
if (i > 0) {
@@ -436,9 +438,9 @@ public class SynchronizerTask extends TimerTask {
EgressRoute er = new EgressRoute(sub, node);
coll.add(er);
} catch (NumberFormatException e) {
- logger.warn("PROV5004: Invalid subid in egress routes: " + key);
+ logger.warn("PROV5004: Invalid subid in egress routes: " + key, e);
} catch (IllegalArgumentException e) {
- logger.warn("PROV5004: Invalid node name in egress routes: " + key);
+ logger.warn("PROV5004: Invalid node name in egress routes: " + key, e);
}
}
if (sync(coll, EgressRoute.getAllEgressRoutes())) {