diff options
Diffstat (limited to 'datarouter-prov')
34 files changed, 256 insertions, 226 deletions
diff --git a/datarouter-prov/pom.xml b/datarouter-prov/pom.xml index 281cea7c..56a4b139 100755 --- a/datarouter-prov/pom.xml +++ b/datarouter-prov/pom.xml @@ -166,7 +166,13 @@ <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> - <version>5.4.1.Final</version> + <version>5.2.9.Final</version> + <exclusions> + <exclusion> + <groupId>dom4j</groupId> + <artifactId>dom4j</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.hamcrest</groupId> @@ -180,8 +186,9 @@ <version>1.0.2.Final</version> </dependency> <dependency> - <groupId>com.thoughtworks.xstream</groupId> - <artifactId>xstream</artifactId> + <groupId>org.dom4j</groupId> + <artifactId>dom4j</artifactId> + <version>2.1.1</version> </dependency> </dependencies> <profiles> 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())) { diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java index 12135969..e766e704 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java @@ -47,6 +47,7 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB; public class EgressRoute extends NodeClass implements Comparable<EgressRoute> {
private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
+ private static final String SQLEXCEPTION = "SQLException: ";
private final int subid;
private final int nodeid;
@@ -57,7 +58,7 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> { * @return the sorted set
*/
public static SortedSet<EgressRoute> getAllEgressRoutes() {
- SortedSet<EgressRoute> set = new TreeSet<EgressRoute>();
+ SortedSet<EgressRoute> set = new TreeSet<>();
try {
DB db = new DB();
@SuppressWarnings("resource")
@@ -74,7 +75,7 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> { db.release(conn);
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error("PROV0008 EgressRoute.getAllEgressRoutes: " + e.getMessage(), e);
}
return set;
}
@@ -104,20 +105,20 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> { ps.close();
db.release(conn);
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error("PROV0009 EgressRoute.getEgressRoute: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return v;
}
- public EgressRoute(int subid, int nodeid) throws IllegalArgumentException {
+ public EgressRoute(int subid, int nodeid) {
this.subid = subid;
this.nodeid = nodeid;
// Note: unlike for Feeds, it subscriptions can be removed from the tables, so it is
@@ -126,7 +127,7 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> { // throw new IllegalArgumentException("No such subscription: "+subid);
}
- public EgressRoute(int subid, String node) throws IllegalArgumentException {
+ public EgressRoute(int subid, String node) {
this(subid, lookupNodeName(node));
}
@@ -141,15 +142,14 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> { ps.execute();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0007 doDelete: " + e.getMessage());
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error("PROV0007 doDelete: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
@@ -169,14 +169,14 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> { ps.close();
rv = true;
} catch (SQLException e) {
- intlogger.warn("PROV0005 doInsert: " + e.getMessage());
+ intlogger.warn("PROV0005 doInsert: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
@@ -194,14 +194,14 @@ public class EgressRoute extends NodeClass implements Comparable<EgressRoute> { ps.executeUpdate();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0006 doUpdate: " + e.getMessage());
+ intlogger.warn("PROV0006 doUpdate: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java index 506821e2..cab4d3d2 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java @@ -47,6 +47,7 @@ import java.util.*; public class Feed extends Syncable {
private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
private static int next_feedid = getMaxFeedID() + 1;
+ private static final String SQLEXCEPTION = "SQLException: ";
private int feedid;
private int groupid; //New field is added - Groups feature Rally:US708115 - 1610
@@ -85,7 +86,7 @@ public class Feed extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.warn("PROV0024 Feed.isFeedValid: ", e.getMessage());
+ intlogger.warn("PROV0024 Feed.isFeedValid: " + e.getMessage(), e);
}
return count != 0;
}
@@ -135,7 +136,7 @@ public class Feed extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.warn("PROV0025 Feed.countActiveFeeds: ", e.getMessage());
+ intlogger.warn("PROV0025 Feed.countActiveFeeds: " + e.getMessage(), e);
}
return count;
}
@@ -155,7 +156,7 @@ public class Feed extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.warn("PROV0026 Feed.getMaxFeedID: ", e.getMessage());
+ intlogger.warn("PROV0026 Feed.getMaxFeedID: " + e.getMessage(), e);
}
return max;
}
@@ -201,7 +202,7 @@ public class Feed extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.warn("PROV0027 Feed.getAllFeeds: ", e.getMessage());
+ intlogger.warn("PROV0027 Feed.getAllFeeds: " + e.getMessage(), e);
}
return map.values();
}
@@ -235,7 +236,7 @@ public class Feed extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.warn("PROV0028 Feed.getFilteredFeedUrlList: ", e.getMessage());
+ intlogger.warn("PROV0028 Feed.getFilteredFeedUrlList: " + e.getMessage(), e);
}
return list;
}
@@ -272,7 +273,7 @@ public class Feed extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.warn("PROV0029 Feed.getFeedBySQL: ", e.getMessage());
+ intlogger.warn("PROV0029 Feed.getFeedBySQL: " + e.getMessage(), e);
}
return feed;
}
@@ -338,6 +339,7 @@ public class Feed extends Syncable { try {
this.version = jo.getString("version");
} catch (JSONException e) {
+ intlogger.warn("PROV0023 Feed.Feed: " + e.getMessage(), e);
this.version = null;
}
if(version != null && version.length() > 20)
@@ -379,11 +381,10 @@ public class Feed extends Syncable { JSONObject jol = jo.optJSONObject("links");
this.links = (jol == null) ? (new FeedLinks()) : (new FeedLinks(jol));
} catch (InvalidObjectException e) {
- intlogger.warn("PROV0030 Feed.Feed: ", e.getMessage());
throw e;
} catch (Exception e) {
- intlogger.error("PROV0031 Feed.Feed: invalid JSON: "+e);
- throw new InvalidObjectException("invalid JSON: " + e.getMessage());
+ intlogger.warn("Invalid JSON: " + e.getMessage(), e);
+ throw new InvalidObjectException("Invalid JSON: " + e.getMessage());
}
}
@@ -555,15 +556,14 @@ public class Feed extends Syncable { ps.execute();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0007 doDelete: " + e.getMessage());
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error("PROV0007 doDelete: " + e.getMessage(), e);
} finally {
try {
if(ps!=null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
@@ -624,8 +624,7 @@ public class Feed extends Syncable { }
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0005 doInsert: " + e.getMessage());
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error("PROV0005 doInsert: " + e.getMessage(), e);
}
return rv;
}
@@ -705,13 +704,13 @@ public class Feed extends Syncable { ps.close();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0006 doUpdate: " + e.getMessage());
+ intlogger.warn("PROV0006 doUpdate: " + e.getMessage(), e);
} finally {
try {
if (ps != null)
ps.close();
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
@@ -737,14 +736,14 @@ public class Feed extends Syncable { ps.close();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0006 doUpdate: " + e.getMessage());
+ intlogger.warn("PROV0008 changeOwnerShip: " + e.getMessage(), e);
} finally {
try {
if(ps!=null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java index 8904765a..be4c6409 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java @@ -46,6 +46,7 @@ public class Group extends Syncable { private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
private static int next_groupid = getMaxGroupID() + 1;
+ private static final String SQLEXCEPTION = "SQLException: ";
private int groupid;
private String authid;
@@ -107,7 +108,7 @@ public class Group extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error("PROV0009 getGroupsForSQL: " + e.getMessage(), e);
}
return list;
}
@@ -127,7 +128,7 @@ public class Group extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.info("getMaxSubID: " + e.getMessage());
+ intlogger.info("PROV0001 getMaxSubID: " + e.getMessage(), e);
}
return max;
}
@@ -150,7 +151,7 @@ public class Group extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error("PROV0002 getGroupsByClassfication: " + e.getMessage(), e);
}
return list;
}
@@ -175,7 +176,7 @@ public class Group extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.warn("PROV0008 countActiveSubscriptions: " + e.getMessage());
+ intlogger.warn("PROV0008 countActiveSubscriptions: " + e.getMessage(), e);
}
return count;
}
@@ -229,7 +230,8 @@ public class Group extends Syncable { } catch (InvalidObjectException e) {
throw e;
} catch (Exception e) {
- throw new InvalidObjectException("invalid JSON: " + e.getMessage());
+ intlogger.warn("Invalid JSON: " + e.getMessage(), e);
+ throw new InvalidObjectException("Invalid JSON: " + e.getMessage());
}
}
@@ -346,14 +348,14 @@ public class Group extends Syncable { ps.close();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0005 doInsert: " + e.getMessage());
+ intlogger.warn("PROV0005 doInsert: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
@@ -375,14 +377,14 @@ public class Group extends Syncable { ps.executeUpdate();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0006 doUpdate: " + e.getMessage());
+ intlogger.warn("PROV0006 doUpdate: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
@@ -399,14 +401,14 @@ public class Group extends Syncable { ps.execute();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0007 doDelete: " + e.getMessage());
+ intlogger.warn("PROV0007 doDelete: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java index bbed37a3..4332d7d7 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java @@ -55,6 +55,7 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB; public class IngressRoute extends NodeClass implements Comparable<IngressRoute> {
private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
+ private static final String SQLEXCEPTION = "SQLException: ";
private final int seq;
private final int feedid;
private final String userid;
@@ -102,7 +103,7 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute> }
db.release(conn);
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error("PROV0001 getAllIngressRoutesForSQL: " + e.getMessage(), e);
}
return set;
}
@@ -140,7 +141,7 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute> }
db.release(conn);
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error("PROV0002 getMax: " + e.getMessage(), e);
}
return rv;
}
@@ -175,14 +176,14 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute> ps.close();
db.release(conn);
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error("PROV0003 getIngressRoute: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return v;
@@ -215,7 +216,7 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute> }
db.release(conn);
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error("PROV0004 getIngressRoute: " + e.getMessage(), e);
}
return rv;
}
@@ -307,6 +308,7 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute> SubnetMatcher sm = new SubnetMatcher(subnet);
return sm.matches(inet.getAddress());
} catch (UnknownHostException e) {
+ intlogger.error("PROV0008 matches: " + e.getMessage(), e);
return false;
}
}
@@ -337,6 +339,7 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute> len = sn.length;
valid = true;
} catch (UnknownHostException e) {
+ intlogger.error("PROV0008 SubnetMatcher: " + e.getMessage(), e);
len = 0;
valid = false;
}
@@ -347,6 +350,7 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute> sn = InetAddress.getByName(subnet.substring(0, i)).getAddress();
valid = true;
} catch (UnknownHostException e) {
+ intlogger.error("PROV0008 SubnetMatcher: " + e.getMessage(), e);
valid = false;
}
len = n / 8;
@@ -390,7 +394,7 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute> }
private Collection<String> readNodes() {
- Collection<String> set = new TreeSet<String>();
+ Collection<String> set = new TreeSet<>();
try {
DB db = new DB();
@SuppressWarnings("resource")
@@ -407,7 +411,7 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute> }
db.release(conn);
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
return set;
}
@@ -434,14 +438,14 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute> ps.execute();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0007 doDelete: " + e.getMessage());
+ intlogger.warn("PROV0007 doDelete: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
@@ -477,14 +481,14 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute> ps.close();
rv = true;
} catch (SQLException e) {
- intlogger.warn("PROV0005 doInsert: " + e.getMessage());
+ intlogger.warn("PROV0005 doInsert: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
@@ -524,14 +528,10 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute> @Override
public boolean equals(Object obj) {
- try {
- if (!(obj instanceof IngressRoute)) {
- return false;
- }
- return this.compareTo((IngressRoute) obj) == 0;
- } catch (NullPointerException e) {
+ if (!(obj instanceof IngressRoute)) {
return false;
}
+ return this.compareTo((IngressRoute) obj) == 0;
}
@Override
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java index 86d1faea..cbddbf43 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java @@ -77,7 +77,7 @@ public class LogRecord extends BaseLogRecord { }
}
} catch (SQLException e) {
- intlogger.error("SQLException: " + e.getMessage());
+ intlogger.error("PROV0001 printLogRecords: " + e.getMessage(), e);
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java index 94eeec4a..eeca0903 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java @@ -47,6 +47,7 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB; public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute> {
private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
+ private static final String SQLEXCEPTION = "SQLException: ";
private final int fromnode;
private final int tonode;
private final int vianode;
@@ -58,7 +59,7 @@ public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute> * @return the sorted set
*/
public static SortedSet<NetworkRoute> getAllNetworkRoutes() {
- SortedSet<NetworkRoute> set = new TreeSet<NetworkRoute>();
+ SortedSet<NetworkRoute> set = new TreeSet<>();
try {
DB db = new DB();
@SuppressWarnings("resource")
@@ -75,30 +76,30 @@ public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute> }
db.release(conn);
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
return set;
}
- public NetworkRoute(String fromnode, String tonode) throws IllegalArgumentException {
+ public NetworkRoute(String fromnode, String tonode) {
this.fromnode = lookupNodeName(fromnode);
this.tonode = lookupNodeName(tonode);
this.vianode = -1;
}
- public NetworkRoute(String fromnode, String tonode, String vianode) throws IllegalArgumentException {
+ public NetworkRoute(String fromnode, String tonode, String vianode) {
this.fromnode = lookupNodeName(fromnode);
this.tonode = lookupNodeName(tonode);
this.vianode = lookupNodeName(vianode);
}
- public NetworkRoute(JSONObject jo) throws IllegalArgumentException {
+ public NetworkRoute(JSONObject jo) {
this.fromnode = lookupNodeName(jo.getString("from"));
this.tonode = lookupNodeName(jo.getString("to"));
this.vianode = lookupNodeName(jo.getString("via"));
}
- public NetworkRoute(int fromnode, int tonode, int vianode) throws IllegalArgumentException {
+ public NetworkRoute(int fromnode, int tonode, int vianode) {
this.fromnode = fromnode;
this.tonode = tonode;
this.vianode = vianode;
@@ -128,14 +129,14 @@ public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute> ps.execute();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0007 doDelete: " + e.getMessage());
+ intlogger.warn("PROV0007 doDelete: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
@@ -157,14 +158,14 @@ public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute> ps.close();
rv = true;
} catch (SQLException e) {
- intlogger.warn("PROV0005 doInsert: " + e.getMessage());
+ intlogger.warn("PROV0005 doInsert: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
}
@@ -184,14 +185,14 @@ public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute> ps.executeUpdate();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0006 doUpdate: " + e.getMessage());
+ intlogger.warn("PROV0006 doUpdate: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java index 08914868..fff10ac7 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java @@ -69,6 +69,7 @@ public class Parameters extends Syncable { public static final String STATIC_ROUTING_NODES = "STATIC_ROUTING_NODES"; //Adding new param for static Routing - Rally:US664862-1610
private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
+ private static final String SQLEXCEPTION = "SQLException: ";
private String keyname;
private String value;
@@ -103,7 +104,7 @@ public class Parameters extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage());
}
return coll;
}
@@ -131,7 +132,7 @@ public class Parameters extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage());
}
return v;
}
@@ -187,14 +188,14 @@ public class Parameters extends Syncable { ps.execute();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0005 doInsert: " + e.getMessage());
+ intlogger.warn("PROV0005 doInsert: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage());
}
}
return rv;
@@ -213,14 +214,14 @@ public class Parameters extends Syncable { ps.executeUpdate();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0006 doUpdate: " + e.getMessage());
+ intlogger.warn("PROV0006 doUpdate: " + e.getMessage(),e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
@@ -238,14 +239,14 @@ public class Parameters extends Syncable { ps.execute();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0007 doDelete: " + e.getMessage());
+ intlogger.warn("PROV0007 doDelete: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error("SQLException " + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java index 442a7642..c12d83d3 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java @@ -117,7 +117,7 @@ public class Subscription extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.error(e.toString());
+ intlogger.error("PROV0001 getSubscriptionsForSQL: " + e.toString(), e);
}
return list;
}
@@ -137,7 +137,7 @@ public class Subscription extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.info("getMaxSubID: " + e.getMessage());
+ intlogger.info("getMaxSubID: " + e.getMessage(), e);
}
return max;
}
@@ -161,7 +161,7 @@ public class Subscription extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.error(SQLEXCEPTION + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
return list;
}
@@ -186,7 +186,7 @@ public class Subscription extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.warn("PROV0008 countActiveSubscriptions: " + e.getMessage());
+ intlogger.warn("PROV0008 countActiveSubscriptions: " + e.getMessage(), e);
}
return count;
}
@@ -274,7 +274,8 @@ public class Subscription extends Syncable { } catch (InvalidObjectException e) {
throw e;
} catch (Exception e) {
- throw new InvalidObjectException("invalid JSON: " + e.getMessage());
+ intlogger.warn("Invalid JSON: " + e.getMessage(), e);
+ throw new InvalidObjectException("Invalid JSON: " + e.getMessage());
}
}
@@ -474,14 +475,14 @@ public class Subscription extends Syncable { ps.close();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0005 doInsert: " + e.getMessage());
+ intlogger.warn("PROV0005 doInsert: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error(SQLEXCEPTION + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
@@ -508,14 +509,14 @@ public class Subscription extends Syncable { ps.executeUpdate();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0006 doUpdate: " + e.getMessage());
+ intlogger.warn("PROV0006 doUpdate: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error(SQLEXCEPTION + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
@@ -541,14 +542,14 @@ public class Subscription extends Syncable { ps.close();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0006 doUpdate: " + e.getMessage());
+ intlogger.warn("PROV0006 doUpdate: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error(SQLEXCEPTION + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
@@ -566,14 +567,14 @@ public class Subscription extends Syncable { ps.execute();
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0007 doDelete: " + e.getMessage());
+ intlogger.warn("PROV0007 doDelete: " + e.getMessage(), e);
} finally {
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- intlogger.error(SQLEXCEPTION + e.getMessage());
+ intlogger.error(SQLEXCEPTION + e.getMessage(), e);
}
}
return rv;
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java index d29876fb..7700a583 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java @@ -84,7 +84,7 @@ public class DB { HTTP_PORT = (String) props.get("org.onap.dmaap.datarouter.provserver.http.port");
Class.forName(DB_DRIVER);
} catch (IOException e) {
- intlogger.error("PROV9003 Opening properties: " + e.getMessage());
+ intlogger.error("PROV9003 Opening properties: " + e.getMessage(), e);
System.exit(1);
} catch (ClassNotFoundException e) {
intlogger.error("PROV9004 cannot find the DB driver: " + e);
@@ -115,6 +115,7 @@ public class DB { try {
connection = queue.remove();
} catch (NoSuchElementException nseEx) {
+ intlogger.error("PROV9006 No connection on queue: " + nseEx.getMessage(), nseEx);
int n = 0;
do {
// Try up to 3 times to get a connection
@@ -194,8 +195,7 @@ public class DB { runInitScript(connection, 1);
}
} catch (SQLException e) {
- intlogger
- .error("PROV9000: The database credentials are not working: " + e.getMessage());
+ intlogger.error("PROV9000: The database credentials are not working: " + e.getMessage(), e);
return false;
} finally {
if (connection != null) {
@@ -223,7 +223,7 @@ public class DB { rs.close();
}
} catch (SQLException e) {
- intlogger.error("PROV9010: Failed to get TABLE data from DB: " + e.getMessage());
+ intlogger.error("PROV9010: Failed to get TABLE data from DB: " + e.getMessage(), e);
}
return tables;
}
@@ -264,7 +264,7 @@ public class DB { lineReader.close();
strBuilder.setLength(0);
} catch (Exception e) {
- intlogger.error("PROV9002 Error when initializing table: " + e.getMessage());
+ intlogger.error("PROV9002 Error when initializing table: " + e.getMessage(), e);
System.exit(1);
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilter.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilter.java index 46cfabec..d5521ba8 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilter.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilter.java @@ -211,7 +211,7 @@ public class DRProvCadiFilter extends CadiFilter { } } catch (Exception e) { - intlogger.error("PROV0073 DRProvCadiFilter.isAAFFeed: ", e.getMessage()); + intlogger.error("PROV0073 DRProvCadiFilter.isAAFFeed: " + e.getMessage(), e); return false; } return false; @@ -241,7 +241,7 @@ public class DRProvCadiFilter extends CadiFilter { intlogger.debug(message); } } catch (Exception e) { - intlogger.error("PROV0073 DRProvCadiFilter.isAAFSubscriber: ", e.getMessage()); + intlogger.error("PROV0073 DRProvCadiFilter.isAAFSubscriber: " + e.getMessage(), e); return false; } return false; diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLI.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLI.java index af8bd6d3..a593c8a7 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLI.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLI.java @@ -24,6 +24,8 @@ package org.onap.dmaap.datarouter.provisioning.utils;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -97,6 +99,7 @@ public class DRRouteCLI { public static final String ENV_VAR = "PROVSRVR";
public static final String PROMPT = "dr-route> ";
public static final String DEFAULT_TRUSTSTORE_PATH = /* $JAVA_HOME + */ "/jre/lib/security/cacerts";
+ private static final EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
private final String server;
private int width = 120; // screen width (for list)
@@ -130,12 +133,13 @@ public class DRRouteCLI { try {
trustStore.load(instream, truststore_pw.toCharArray());
} catch (Exception x) {
- System.err.println("Problem reading truststore: " + x);
+ intlogger.error("Problem reading truststore: " + x.getMessage(), x);
throw x;
} finally {
try {
instream.close();
} catch (Exception ignore) {
+ intlogger.error("Ignore error closing input stream: " + ignore.getMessage(), ignore);
}
}
}
@@ -397,6 +401,7 @@ public class DRRouteCLI { printErrorText(entity);
}
} catch (Exception e) {
+ intlogger.error("PROV0006 doDelete: " + e.getMessage(), e);
} finally {
meth.releaseConnection();
}
@@ -416,7 +421,7 @@ public class DRRouteCLI { printErrorText(entity);
}
} catch (Exception e) {
- System.err.println(e);
+ intlogger.error("PROV0005 doGet: " + e.getMessage(), e);
} finally {
meth.releaseConnection();
}
@@ -438,6 +443,7 @@ public class DRRouteCLI { printErrorText(entity);
}
} catch (Exception e) {
+ intlogger.error("PROV0009 doPost: " + e.getMessage(), e);
} finally {
meth.releaseConnection();
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/HttpServletUtils.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/HttpServletUtils.java index 3aa3bd28..d9f36de3 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/HttpServletUtils.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/HttpServletUtils.java @@ -32,7 +32,7 @@ public class HttpServletUtils { try { response.sendError(errorCode, message); } catch (IOException ioe) { - intlogger.error("IOException" + ioe.getMessage()); + intlogger.error("IOException" + ioe.getMessage(), ioe); } } } diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/JSONUtilities.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/JSONUtilities.java index 915aa610..2d4e22b3 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/JSONUtilities.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/JSONUtilities.java @@ -24,6 +24,8 @@ package org.onap.dmaap.datarouter.provisioning.utils;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collection;
@@ -35,6 +37,8 @@ import java.util.Collection; * @version $Id: JSONUtilities.java,v 1.1 2013/04/26 21:00:26 eby Exp $
*/
public class JSONUtilities {
+
+ private static final EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
/**
* Does the String <i>v</i> represent a valid Internet address (with or without a
* mask length appended).
@@ -56,6 +60,7 @@ public class JSONUtilities { }
return true;
} catch (UnknownHostException e) {
+ intlogger.error("PROV0001: " + e.getMessage(), e);
return false;
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java index 1518859a..f7e08748 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java @@ -23,6 +23,8 @@ package org.onap.dmaap.datarouter.provisioning.utils; * * ******************************************************************************/ +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; @@ -104,6 +106,8 @@ public class LOGJSONObject { */ private static Map<String, Object> keyPool = new LinkedHashMap<String, Object>(keyPoolSize); + private static final EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog"); + /** * JSONObject.NULL is equivalent to the value that JavaScript calls null, * whilst Java's null is equivalent to the value that JavaScript calls @@ -202,7 +206,7 @@ public class LOGJSONObject { * Construct an empty JSONObject. */ public LOGJSONObject() { - this.map = new LinkedHashMap<String, Object>(); + this.map = new LinkedHashMap<>(); } @@ -213,8 +217,6 @@ public class LOGJSONObject { * * @param jo A JSONObject. * @param names An array of strings. - * @throws JSONException - * @throws JSONException If a value is a non-finite number or if a name is duplicated. */ public LOGJSONObject(LOGJSONObject jo, String[] names) { this(); @@ -222,6 +224,7 @@ public class LOGJSONObject { try { this.putOnce(names[i], jo.opt(names[i])); } catch (Exception ignore) { + intlogger.error("PROV0001 LOGJSONObject: " + ignore.getMessage(), ignore); } } } @@ -234,7 +237,7 @@ public class LOGJSONObject { * @throws JSONException If there is a syntax error in the source string * or a duplicated key. */ - public LOGJSONObject(JSONTokener x) throws JSONException { + public LOGJSONObject(JSONTokener x) { this(); char c; String key; @@ -555,15 +558,15 @@ public class LOGJSONObject { * @throws JSONException if the key is not found or * if the value is not a Number object and cannot be converted to a number. */ - public double getDouble(String key) throws JSONException { + public double getDouble(String key) { Object object = this.get(key); try { return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object); } catch (Exception e) { - throw new JSONException("JSONObject[" + quote(key) + - "] is not a number."); + intlogger.error("JSONObject[" + quote(key) + "] is not a number.", e); + throw new JSONException("JSONObject[" + quote(key) + "] is not a number."); } } @@ -576,15 +579,15 @@ public class LOGJSONObject { * @throws JSONException if the key is not found or if the value cannot * be converted to an integer. */ - public int getInt(String key) throws JSONException { + public int getInt(String key) { Object object = this.get(key); try { return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object); } catch (Exception e) { - throw new JSONException("JSONObject[" + quote(key) + - "] is not an int."); + intlogger.error("JSONObject[" + quote(key) + "] is not an int.", e); + throw new JSONException("JSONObject[" + quote(key) + "] is not an int."); } } @@ -640,8 +643,8 @@ public class LOGJSONObject { ? ((Number) object).longValue() : Long.parseLong((String) object); } catch (Exception e) { - throw new JSONException("JSONObject[" + quote(key) + - "] is not a long."); + intlogger.error("JSONObject[" + quote(key) + "] is not a long.", e); + throw new JSONException("JSONObject[" + quote(key) + "] is not a long."); } } @@ -697,7 +700,7 @@ public class LOGJSONObject { * @return A string which is the value. * @throws JSONException if there is no string value for the key. */ - public String getString(String key) throws JSONException { + public String getString(String key) { Object object = this.get(key); if (object instanceof String) { return (String) object; @@ -728,7 +731,7 @@ public class LOGJSONObject { * @throws JSONException If there is already a property with this name * that is not an Integer, Long, Double, or Float. */ - public LOGJSONObject increment(String key) throws JSONException { + public LOGJSONObject increment(String key) { Object value = this.opt(key); if (value == null) { this.put(key, 1); @@ -873,6 +876,7 @@ public class LOGJSONObject { try { return this.getBoolean(key); } catch (Exception e) { + intlogger.trace("Using defaultValue: " + defaultValue, e); return defaultValue; } } @@ -906,6 +910,7 @@ public class LOGJSONObject { try { return this.getDouble(key); } catch (Exception e) { + intlogger.trace("Using defaultValue: " + defaultValue, e); return defaultValue; } } @@ -939,6 +944,7 @@ public class LOGJSONObject { try { return this.getInt(key); } catch (Exception e) { + intlogger.trace("Using defaultValue: " + defaultValue, e); return defaultValue; } } @@ -1075,6 +1081,7 @@ public class LOGJSONObject { } } } catch (Exception ignore) { + intlogger.trace("populateMap: " + ignore.getMessage(), ignore); } } } @@ -1256,8 +1263,8 @@ public class LOGJSONObject { synchronized (sw.getBuffer()) { try { return quote(string, sw).toString(); - } catch (IOException ignored) { - // will never happen - we are writing to a string writer + } catch (IOException e) { + intlogger.trace("Ignore Exception message: ", e); return ""; } } @@ -1380,7 +1387,8 @@ public class LOGJSONObject { return myLong; } } - } catch (Exception ignore) { + } catch (Exception e) { + intlogger.trace("Ignore Exception message: ", e); } } return string; @@ -1393,7 +1401,7 @@ public class LOGJSONObject { * @param o The object to test. * @throws JSONException If o is a non-finite number. */ - public static void testValidity(Object o) throws JSONException { + public static void testValidity(Object o) { if (o != null) { if (o instanceof Double) { if (((Double) o).isInfinite() || ((Double) o).isNaN()) { @@ -1446,6 +1454,7 @@ public class LOGJSONObject { try { return this.toString(0); } catch (Exception e) { + intlogger.trace("Exception: ", e); return ""; } } @@ -1579,6 +1588,7 @@ public class LOGJSONObject { } return new LOGJSONObject(object); } catch (Exception exception) { + intlogger.trace("Exception: ", exception); return null; } } diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java index 82231884..3ba1a151 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java @@ -416,7 +416,7 @@ public class LogfileLoader extends Thread { }
} catch (SQLException e) {
logger.warn("PROV8003 Invalid value in record: " + line);
- logger.debug(e.toString());
+ logger.debug(e.toString(), e);
} catch (NumberFormatException e) {
logger.warn("PROV8004 Invalid number in record: " + line);
logger.debug(e.toString());
@@ -425,7 +425,7 @@ public class LogfileLoader extends Thread { logger.debug(e.toString());
} catch (Exception e) {
logger.warn("PROV8006 Invalid pattern in record: " + line);
- logger.debug(e.toString());
+ logger.debug(e.toString(), e);
}
total++;
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTask.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTask.java index f3e84b4a..8c67e71f 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTask.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTask.java @@ -51,7 +51,7 @@ public class PurgeLogDirTask extends TimerTask { logdir = p.getProperty("org.onap.dmaap.datarouter.provserver.accesslog.dir");
String s = p.getProperty("org.onap.dmaap.datarouter.provserver.logretention", "30");
- this.utilsLogger = EELFManager.getInstance().getLogger("UtilsLog");;
+ this.utilsLogger = EELFManager.getInstance().getLogger("UtilsLog");
long n = 30;
try {
@@ -75,7 +75,7 @@ public class PurgeLogDirTask extends TimerTask { }
}
} catch (Exception e) {
- utilsLogger.error("Exception: " + e.getMessage());
+ utilsLogger.error("Exception: " + e.getMessage(), e);
}
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilter.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilter.java index c9fb5a16..5c1fd560 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilter.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilter.java @@ -138,7 +138,7 @@ public class ThrottleFilter extends TimerTask implements Filter { }
}
} catch (ClassNotFoundException e) {
- logger.warn("Class " + JETTY_REQUEST + " is not available; this filter requires Jetty.");
+ logger.warn("Class " + JETTY_REQUEST + " is not available; this filter requires Jetty.", e);
}
}
logger.info("ThrottleFilter is DISABLED for /publish requests.");
@@ -275,7 +275,7 @@ public class ThrottleFilter extends TimerTask implements Filter { t = times.get(0);
}
} catch (IndexOutOfBoundsException e) {
- // ignore
+ logger.trace("Exception: " + e.getMessage(), e);
}
return times.size();
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/URLUtilities.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/URLUtilities.java index 0c6afdd7..ffed1a1b 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/URLUtilities.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/URLUtilities.java @@ -24,6 +24,8 @@ package org.onap.dmaap.datarouter.provisioning.utils;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
@@ -37,7 +39,7 @@ import org.onap.dmaap.datarouter.provisioning.BaseServlet; * @version $Id: URLUtilities.java,v 1.2 2014/03/12 19:45:41 eby Exp $
*/
public class URLUtilities {
-
+ private static final EELFLogger utilsLogger = EELFManager.getInstance().getLogger("UtilsLog");
/**
* Generate the URL used to access a feed.
*
@@ -134,6 +136,7 @@ public class URLUtilities { this_pod = InetAddress.getLocalHost().getHostName();
System.out.println("this_pod: " + this_pod);
} catch (UnknownHostException e) {
+ utilsLogger.trace("UnkownHostException: " + e.getMessage(), e);
this_pod = "";
}
System.out.println("ALL PODS: " + Arrays.asList(BaseServlet.getPods()));
|