diff options
58 files changed, 491 insertions, 333 deletions
@@ -3,9 +3,9 @@ project: 'dmaap-datarouter' project_creation_date: '2017-06-30' lifecycle_state: 'Incubation' project_lead: &onap_releng_ptl - name: 'Ram Koya' - email: 'rk541m@att.com' - id: 'rampi_k' + name: 'Mandar Sawant' + email: 'ms5838@att.com' + id: 'sawantmandar' company: 'ATT' timezone: 'America/Dallas' primary_contact: *onap_releng_ptl @@ -45,11 +45,6 @@ committers: company: 'ATT' id: 'sawantmandar' timezone: 'America/Dallas' - - name: 'Varun Gudisena' - email: 'vg411h@att.com' - company: 'ATT' - id: 'vg411h' - timezone: 'America/Dallas' - name: 'Bhanu Ramesh' email: 'bg6954@att.com' company: 'ATT' @@ -69,7 +64,13 @@ committers: email: 'conor.ward@ericsson.com' company: 'ericsson' id: 'econwar' - timezone: 'America/Dallas' + timezone: 'Europe/Dublin' + - name: 'Fiachra Corcoran' + email: 'fiachra.corcoran@est.tech' + company: 'ericsson' + id: 'efiacor' + timezone: 'Europe/Dublin' + tsc: approval: 'https://lists.onap.org/pipermail/onap-tsc' changes: @@ -78,3 +79,4 @@ tsc: name: 'Xinhui Li' name: 'Jing Wang' name: 'Ramdas Sawant' + name: 'Varun Gudisena' diff --git a/datarouter-node/pom.xml b/datarouter-node/pom.xml index 537b05b5..06aa3fcf 100755 --- a/datarouter-node/pom.xml +++ b/datarouter-node/pom.xml @@ -128,10 +128,6 @@ <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> - <dependency> - <groupId>com.thoughtworks.xstream</groupId> - <artifactId>xstream</artifactId> - </dependency> </dependencies> <profiles> <profile> diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilter.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilter.java index 30ad1618..991d8660 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilter.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilter.java @@ -74,7 +74,7 @@ public class DRNodeCadiFilter extends CadiFilter { try { resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Invalid request URI. Expecting <feed-publishing-url>/<fileid>."); } catch (IOException e) { - logger.error("NODE0541 DRNodeCadiFilter.getFeedId: ", e.getMessage()); + logger.error("NODE0541 DRNodeCadiFilter.getFeedId: ", e); } return null; } @@ -88,7 +88,7 @@ public class DRNodeCadiFilter extends CadiFilter { try { resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Invalid request URI. Expecting <feed-publishing-url>/<fileid>. Possible missing fileid."); } catch (IOException e) { - logger.error("NODE0542 DRNodeCadiFilter.getFeedId: ", e.getMessage()); + logger.error("NODE0542 DRNodeCadiFilter.getFeedId: ", e); } return null; } diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java index 501e489c..4c21b342 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java @@ -68,6 +68,24 @@ public class Delivery { this.pubid = pubid; this.spool = spool; } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DelItem delItem = (DelItem) o; + return Objects.equals(pubid, delItem.pubid) && + Objects.equals(getSpool(), delItem.getSpool()); + } + + @Override + public int hashCode() { + return Objects.hash(pubid, getSpool()); + } } private double fdstart; @@ -246,6 +264,7 @@ public class Delivery { try { wait(nextcheck + 500 - now); } catch (Exception e) { + logger.error("InterruptedException", e); } now = System.currentTimeMillis(); } diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryQueue.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryQueue.java index bef8dab2..3d485878 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryQueue.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryQueue.java @@ -24,6 +24,8 @@ package org.onap.dmaap.datarouter.node; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import java.io.*; import java.util.*; @@ -64,6 +66,7 @@ import java.util.*; * failure timer is active or if no files are found in a directory scan. */ public class DeliveryQueue implements Runnable, DeliveryTaskHelper { + private static EELFLogger logger = EELFManager.getInstance().getLogger(DeliveryQueue.class); private DeliveryQueueHelper deliveryQueueHelper; private DestInfo destinationInfo; private Hashtable<String, DeliveryTask> working = new Hashtable<>(); @@ -215,6 +218,7 @@ public class DeliveryQueue implements Runnable, DeliveryTaskHelper { try { pidtime = Long.parseLong(fname2.substring(0, dot)); } catch (Exception e) { + logger.error("Exception", e); } if (pidtime < 1000000000000L) { continue; diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java index cca61707..018c3aff 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java @@ -127,7 +127,7 @@ public class DeliveryTask implements Runnable, Comparable<DeliveryTask> { hdrv.add(new String[]{h, v}); } } catch (Exception e) { - eelfLogger.error("Exception "+ Arrays.toString(e.getStackTrace()), e.getMessage()); + eelfLogger.error("Exception", e); } hdrs = hdrv.toArray(new String[hdrv.size()][]); url = deliveryTaskHelper.getDestURL(fileid); @@ -272,7 +272,7 @@ public class DeliveryTask implements Runnable, Comparable<DeliveryTask> { outputStream.close(); } catch (IOException e) { httpURLConnection.setRequestProperty("Decompression_Status", "FAILURE"); - eelfLogger.info("Could not decompress file"); + eelfLogger.info("Could not decompress file", e); sendFile(httpURLConnection); } diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DestInfo.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DestInfo.java index 8aa339f5..8890fe96 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DestInfo.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DestInfo.java @@ -41,35 +41,105 @@ public class DestInfo { private boolean decompress; private boolean followRedirects; private String aafInstance; - /** - * Create a destination information object. - * - * @param name n:fqdn or s:subid - * @param spool The directory where files are spooled. - * @param subid The subscription ID (if applicable). - * @param logdata Text to be included in log messages - * @param url The URL to deliver to. - * @param authuser The auth user for logging. - * @param authentication The credentials. - * @param metaonly Is this a metadata only delivery? - * @param use100 Should I use expect 100-continue? - * @param privilegedSubscriber Can we wait to receive a file processed acknowledgement before deleting file - * @param followRedirects Is follow redirect of destination enabled? - * @param decompress To see if the they want there information compressed or decompressed - */ - public DestInfo(String name, String spool, String subid, String logdata, String url, String authuser, String authentication, boolean metaonly, boolean use100, boolean privilegedSubscriber, boolean followRedirects, boolean decompress) { - this.name = name; - this.spool = spool; - this.subid = subid; - this.logdata = logdata; - this.url = url; - this.authuser = authuser; - this.authentication = authentication; - this.metaonly = metaonly; - this.use100 = use100; - this.privilegedSubscriber = privilegedSubscriber; - this.followRedirects = followRedirects; - this.decompress = decompress; + + public static class DestInfoBuilder { + private String name; + private String spool; + private String subid; + private String logdata; + private String url; + private String authuser; + private String authentication; + private boolean metaonly; + private boolean use100; + private boolean privilegedSubscriber; + private boolean followRedirects; + private boolean decompress; + private NodeConfig.ProvSubscription subscription; + + public DestInfoBuilder setName(String name) { + this.name = name; + return this; + } + + public DestInfoBuilder setSpool(String spool) { + this.spool = spool; + return this; + } + + public DestInfoBuilder setSubid(String subid) { + this.subid = subid; + return this; + } + + public DestInfoBuilder setLogdata(String logdata) { + this.logdata = logdata; + return this; + } + + public DestInfoBuilder setUrl(String url) { + this.url = url; + return this; + } + + public DestInfoBuilder setAuthuser(String authuser) { + this.authuser = authuser; + return this; + } + + public DestInfoBuilder setAuthentication(String authentication) { + this.authentication = authentication; + return this; + } + + public DestInfoBuilder setMetaonly(boolean metaonly) { + this.metaonly = metaonly; + return this; + } + + public DestInfoBuilder setUse100(boolean use100) { + this.use100 = use100; + return this; + } + + public DestInfoBuilder setPrivilegedSubscriber(boolean privilegedSubscriber) { + this.privilegedSubscriber = privilegedSubscriber; + return this; + } + + public DestInfoBuilder setFollowRedirects(boolean followRedirects) { + this.followRedirects = followRedirects; + return this; + } + + public DestInfoBuilder setDecompress(boolean decompress) { + this.decompress = decompress; + return this; + } + + public DestInfoBuilder setSubscription(NodeConfig.ProvSubscription subscription) { + this.subscription = subscription; + return this; + } + + public DestInfo createDestInfo() { + return new DestInfo(this); + } + } + + public DestInfo(DestInfoBuilder destInfoBuilder) { + this.name = destInfoBuilder.name; + this.spool = destInfoBuilder.spool; + this.subid = destInfoBuilder.subid; + this.logdata = destInfoBuilder.logdata; + this.url = destInfoBuilder.url; + this.authuser = destInfoBuilder.authuser; + this.authentication = destInfoBuilder.authentication; + this.metaonly = destInfoBuilder.metaonly; + this.use100 = destInfoBuilder.use100; + this.privilegedSubscriber = destInfoBuilder.privilegedSubscriber; + this.followRedirects = destInfoBuilder.followRedirects; + this.decompress = destInfoBuilder.decompress; } /** diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/IsFrom.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/IsFrom.java index f7cedd22..534b2b35 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/IsFrom.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/IsFrom.java @@ -71,7 +71,7 @@ public class IsFrom { hostAddrArray.add(addr.getHostAddress()); } } catch (UnknownHostException e) { - logger.error("IsFrom: UnknownHostEx: " + e.toString(), e.getMessage()); + logger.error("IsFrom: UnknownHostEx: " + e.toString(), e); } ips = hostAddrArray.toArray(new String[0]); logger.info("IsFrom: DNS ENTRIES FOR FQDN " + fqdn + " : " + Arrays.toString(ips)); @@ -90,9 +90,9 @@ public class IsFrom { return true; } } catch (UnknownHostException e) { - logger.error("IsFrom: UnknownHostEx: " + e.toString(), e.getMessage()); + logger.error("IsFrom: UnknownHostEx: " + e.toString(), e); } catch (IOException e) { - logger.error("IsFrom: Failed to parse IP : " + ip + " : " + e.toString(), e.getMessage()); + logger.error("IsFrom: Failed to parse IP : " + ip + " : " + e.toString(), e); } return false; } diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/LogManager.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/LogManager.java index 3fa5dc29..6ffb7604 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/LogManager.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/LogManager.java @@ -22,6 +22,8 @@ ******************************************************************************/ package org.onap.dmaap.datarouter.node; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -43,7 +45,7 @@ import java.util.regex.Pattern; */ public class LogManager extends TimerTask { - + private EELFLogger logger = EELFManager.getInstance().getLogger(LogManager.class); private NodeConfigManager config; private Matcher isnodelog; private Matcher iseventlog; @@ -52,6 +54,7 @@ public class LogManager extends TimerTask { private String logdir; private class Uploader extends Thread implements DeliveryQueueHelper { + private EELFLogger logger = EELFManager.getInstance().getLogger(Uploader.class); public long getInitFailureTimer() { return (10000L); @@ -104,7 +107,10 @@ public class LogManager extends TimerTask { public Uploader() { dq = new DeliveryQueue(this, - new DestInfo("LogUpload", uploaddir, null, null, null, config.getMyName(), config.getMyAuth(), false, false, false, false, false)); + new DestInfo.DestInfoBuilder().setName("LogUpload").setSpool(uploaddir).setSubid(null).setLogdata(null) + .setUrl(null).setAuthuser(config.getMyName()).setAuthentication(config.getMyAuth()) + .setMetaonly(false).setUse100(false).setPrivilegedSubscriber(false).setFollowRedirects(false) + .setDecompress(false).createDestInfo()); setDaemon(true); setName("Log Uploader"); start(); @@ -114,6 +120,7 @@ public class LogManager extends TimerTask { try { wait(10000); } catch (Exception e) { + logger.error("InterruptedException", e); } } @@ -145,6 +152,7 @@ public class LogManager extends TimerTask { lastqueued = br.readLine(); br.close(); } catch (Exception e) { + logger.error("Exception", e); } for (String fn : fns) { if (!isnodelog.reset(fn).matches()) { @@ -158,6 +166,7 @@ public class LogManager extends TimerTask { Files.createLink(Paths.get(uploaddir + "/" + pid), Paths.get(logdir + "/" + fn)); Files.createLink(Paths.get(uploaddir + "/" + pid + ".M"), Paths.get(uploaddir + "/.meta")); } catch (Exception e) { + logger.error("Exception", e); } } } @@ -170,6 +179,7 @@ public class LogManager extends TimerTask { (new File(uploaddir + "/.meta")).delete(); w.write(lastqueued + "\n"); } catch (Exception e) { + logger.error("Exception", e); } } } @@ -186,6 +196,7 @@ public class LogManager extends TimerTask { isnodelog = Pattern.compile("node\\.log\\.\\d{8}").matcher(""); iseventlog = Pattern.compile("events-\\d{12}\\.log").matcher(""); } catch (Exception e) { + logger.error("Exception", e); } logdir = config.getLogDir(); uploaddir = logdir + "/.spool"; diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfig.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfig.java index 23512a14..d455f2d9 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfig.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfig.java @@ -559,8 +559,10 @@ public class NodeConfig { continue; } String auth = NodeUtils.getNodeAuthHdr(cName, nodeauthkey); - DestInfo di = new DestInfo("n:" + cName, spooldir + "/n/" + cName, null, "n2n-" + cName, - "https://" + cName + ":" + port + "/internal/publish", cName, myauth, false, true, false, false, false); + DestInfo di = new DestInfo.DestInfoBuilder().setName("n:" + cName).setSpool(spooldir + "/n/" + cName).setSubid(null) + .setLogdata("n2n-" + cName).setUrl("https://" + cName + ":" + port + "/internal/publish") + .setAuthuser(cName).setAuthentication(myauth).setMetaonly(false).setUse100(true) + .setPrivilegedSubscriber(false).setFollowRedirects(false).setDecompress(false).createDestInfo(); (new File(di.getSpool())).mkdirs(); destInfos.add(di); nodeinfo.put(cName, di); diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java index 16099e62..884f7bf9 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java @@ -121,7 +121,7 @@ public class NodeConfigManager implements DeliveryQueueHelper { .getProperty("org.onap.dmaap.datarouter.node.properties", "/opt/app/datartr/etc/node.properties"))); } catch (Exception e) { NodeUtils.setIpAndFqdnForEelf("NodeConfigManager"); - eelfLogger.error(EelfMsgs.MESSAGE_PROPERTIES_LOAD_ERROR, System.getProperty("org.onap.dmaap.datarouter.node.properties", "/opt/app/datartr/etc/node.properties")); + eelfLogger.error(EelfMsgs.MESSAGE_PROPERTIES_LOAD_ERROR, e, System.getProperty("org.onap.dmaap.datarouter.node.properties", "/opt/app/datartr/etc/node.properties")); } provurl = drNodeProperties.getProperty("ProvisioningURL", "https://dmaap-dr-prov:8443/internal/prov"); /* @@ -144,7 +144,7 @@ public class NodeConfigManager implements DeliveryQueueHelper { provhost = (new URL(provurl)).getHost(); } catch (Exception e) { NodeUtils.setIpAndFqdnForEelf("NodeConfigManager"); - eelfLogger.error(EelfMsgs.MESSAGE_BAD_PROV_URL, provurl); + eelfLogger.error(EelfMsgs.MESSAGE_BAD_PROV_URL, e, provurl); System.exit(1); } eelfLogger.info("NODE0303 Provisioning server is " + provhost); @@ -218,42 +218,52 @@ public class NodeConfigManager implements DeliveryQueueHelper { try { initfailuretimer = (long) (Double.parseDouble(getProvParam("DELIVERY_INIT_RETRY_INTERVAL")) * 1000); } catch (Exception e) { + eelfLogger.error("Error parsing DELIVERY_INIT_RETRY_INTERVAL", e); } try { waitForFileProcessFailureTimer = (long) (Double.parseDouble(getProvParam("DELIVERY_FILE_PROCESS_INTERVAL")) * 1000); } catch (Exception e) { + eelfLogger.error("Error parsing DELIVERY_FILE_PROCESS_INTERVAL", e); } try { maxfailuretimer = (long) (Double.parseDouble(getProvParam("DELIVERY_MAX_RETRY_INTERVAL")) * 1000); } catch (Exception e) { + eelfLogger.error("Error parsing DELIVERY_MAX_RETRY_INTERVAL", e); } try { expirationtimer = (long) (Double.parseDouble(getProvParam("DELIVERY_MAX_AGE")) * 1000); } catch (Exception e) { + eelfLogger.error("Error parsing DELIVERY_MAX_AGE", e); } try { failurebackoff = Double.parseDouble(getProvParam("DELIVERY_RETRY_RATIO")); } catch (Exception e) { + eelfLogger.error("Error parsing DELIVERY_RETRY_RATIO", e); } try { deliverythreads = Integer.parseInt(getProvParam("DELIVERY_THREADS")); } catch (Exception e) { + eelfLogger.error("Error parsing DELIVERY_THREADS", e); } try { fairfilelimit = Integer.parseInt(getProvParam("FAIR_FILE_LIMIT")); } catch (Exception e) { + eelfLogger.error("Error parsing FAIR_FILE_LIMIT", e); } try { fairtimelimit = (long) (Double.parseDouble(getProvParam("FAIR_TIME_LIMIT")) * 1000); } catch (Exception e) { + eelfLogger.error("Error parsing FAIR_TIME_LIMIT", e); } try { fdpstart = Double.parseDouble(getProvParam("FREE_DISK_RED_PERCENT")) / 100.0; } catch (Exception e) { + eelfLogger.error("Error parsing FREE_DISK_RED_PERCENT", e); } try { fdpstop = Double.parseDouble(getProvParam("FREE_DISK_YELLOW_PERCENT")) / 100.0; } catch (Exception e) { + eelfLogger.error("Error parsing FREE_DISK_YELLOW_PERCENT", e); } if (fdpstart < 0.01) { fdpstart = 0.01; @@ -287,7 +297,7 @@ public class NodeConfigManager implements DeliveryQueueHelper { } catch (Exception e) { NodeUtils.setIpAndFqdnForEelf("fetchconfigs"); eelfLogger.error(EelfMsgs.MESSAGE_CONF_FAILED, e.toString()); - eelfLogger.error("NODE0306 Configuration failed " + e.toString() + " - try again later", e.getMessage()); + eelfLogger.error("NODE0306 Configuration failed " + e.toString() + " - try again later", e); pfetcher.request(); } } @@ -842,7 +852,7 @@ public class NodeConfigManager implements DeliveryQueueHelper { } return type + "|" + aafInstance + "|" + action; } catch (Exception e) { - eelfLogger.error("NODE0543 NodeConfigManager.getPermission: ", e.getMessage()); + eelfLogger.error("NODE0543 NodeConfigManager.getPermission: ", e); } return null; } diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java index 058295d3..7a2691e4 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java @@ -56,7 +56,7 @@ public class NodeMain { try { in = getClass().getClassLoader().getResourceAsStream("drNodeCadi.properties"); } catch (Exception e) { - nodeMainLogger.error("Exception in Inner.getCadiProps() method " + e.getMessage()); + nodeMainLogger.error("Exception in Inner.getCadiProps() method ", e); } return in; } @@ -181,7 +181,7 @@ public class NodeMain { InputStream in = obj.getCadiProps(); cadiProperties.load(in); } catch (IOException e1) { - nodeMainLogger.error("NODE00005 Exception in NodeMain.Main() loading CADI properties " + e1.getMessage()); + nodeMainLogger.error("NODE00005 Exception in NodeMain.Main() loading CADI properties ", e1); } cadiProperties.setProperty("aaf_locate_url", nodeConfigManager.getAafURL()); nodeMainLogger.info("NODE00005 aaf_url set to - " + cadiProperties.getProperty("aaf_url")); @@ -199,7 +199,7 @@ public class NodeMain { server.start(); nodeMainLogger.info("NODE00006 Node Server started-" + server.getState()); } catch (Exception e) { - nodeMainLogger.info("NODE00006 Jetty failed to start. Reporting will we unavailable", e.getMessage()); + nodeMainLogger.info("NODE00006 Jetty failed to start. Reporting will we unavailable", e); } server.join(); nodeMainLogger.info("NODE00007 Node Server joined - " + server.getState()); diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java index a9842116..d665080b 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java @@ -117,7 +117,7 @@ public class NodeServlet extends HttpServlet { } } catch (IOException ioe) { - eelfLogger.error("IOException" + ioe.getMessage()); + eelfLogger.error("IOException", ioe); } String path = req.getPathInfo(); String qs = req.getQueryString(); @@ -158,7 +158,7 @@ public class NodeServlet extends HttpServlet { try { common(req, resp, true); } catch (IOException ioe) { - eelfLogger.error("IOException" + ioe.getMessage()); + eelfLogger.error("IOException", ioe); eelfLogger.info(EelfMsgs.EXIT); } } @@ -176,7 +176,7 @@ public class NodeServlet extends HttpServlet { try { common(req, resp, false); } catch (IOException ioe) { - eelfLogger.error("IOException " + ioe.getMessage()); + eelfLogger.error("IOException", ioe); eelfLogger.info(EelfMsgs.EXIT); } } @@ -437,7 +437,7 @@ public class NodeServlet extends HttpServlet { try { exlen = Long.parseLong(req.getHeader("Content-Length")); } catch (Exception e) { - eelfLogger.error("NODE00000 Exception common: " + e.getMessage()); + eelfLogger.error("NODE00000 Exception common", e); } StatusLog.logPubFail(pubid, feedid, logurl, req.getMethod(), ctype, exlen, data.length(), ip, user, ioe.getMessage()); //Fortify scan fixes - log forging @@ -520,7 +520,7 @@ public class NodeServlet extends HttpServlet { } } catch (IOException ioe) { eelfLogger.error("NODE0117 Unable to delete files (" + pubid + ", " + pubid + ".M) from DR Node: " - + config.getMyName() + ". Error: " + ioe.getMessage()); + + config.getMyName(), ioe); eelfLogger.info(EelfMsgs.EXIT); } } @@ -562,7 +562,8 @@ public class NodeServlet extends HttpServlet { return false; } } catch (NullPointerException npe) { - eelfLogger.error("NODE0114 " + errorMessage + " Error: Subscription " + subscriptionId + " does not exist"); + eelfLogger.error("NODE0114 " + errorMessage + " Error: Subscription " + subscriptionId + + " does not exist", npe); resp.sendError(HttpServletResponse.SC_NOT_FOUND); eelfLogger.info(EelfMsgs.EXIT); return false; diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java index 4601f99c..da84ae54 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java @@ -126,7 +126,7 @@ public class NodeUtils { } } catch (Exception e) { setIpAndFqdnForEelf("getCanonicalName"); - eelfLogger.error(EelfMsgs.MESSAGE_KEYSTORE_LOAD_ERROR, ksfile, e.toString()); + eelfLogger.error(EelfMsgs.MESSAGE_KEYSTORE_LOAD_ERROR, e, ksfile); return (null); } return (getCanonicalName(ks)); @@ -161,7 +161,7 @@ public class NodeUtils { } } } catch (Exception e) { - eelfLogger.error("NODE0402 Error extracting my name from my keystore file " + e.toString(), e.getMessage()); + eelfLogger.error("NODE0402 Error extracting my name from my keystore file " + e.toString(), e); } return (null); } @@ -283,7 +283,7 @@ public class NodeUtils { try { response.sendError(errorCode); } catch (IOException ioe) { - intlogger.error("IOException" + ioe.getMessage()); + intlogger.error("IOException", ioe); } } diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/RedirManager.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/RedirManager.java index 7e4078f8..4cd650b0 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/RedirManager.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/RedirManager.java @@ -24,9 +24,12 @@ package org.onap.dmaap.datarouter.node; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import java.io.BufferedReader; import java.io.FileOutputStream; import java.io.FileReader; +import java.io.IOException; import java.io.OutputStream; import java.util.Hashtable; import java.util.Timer; @@ -35,7 +38,7 @@ import java.util.Timer; * Track redirections of subscriptions */ public class RedirManager { - + private static EELFLogger eelfLogger = EELFManager.getInstance().getLogger(RedirManager.class); private Hashtable<String, String> sid2primary = new Hashtable<String, String>(); private Hashtable<String, String> sid2secondary = new Hashtable<String, String>(); private String redirfile; @@ -63,6 +66,7 @@ public class RedirManager { os.write(sb.toString().getBytes()); } } catch (Exception e) { + eelfLogger.error("Exception", e); } } }; @@ -80,7 +84,7 @@ public class RedirManager { } } } catch (Exception e) { - // missing file is normal + eelfLogger.error("Missing file is normal", e); } } diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java index c8a7bd0c..1be3408a 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java @@ -23,6 +23,8 @@ package org.onap.dmaap.datarouter.node; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import java.util.regex.*; import java.util.*; import java.io.*; @@ -33,6 +35,7 @@ import java.text.*; * Logging for data router delivery events (PUB/DEL/EXP) */ public class StatusLog { + private static EELFLogger eelfLogger = EELFManager.getInstance().getLogger(StatusLog.class); private static StatusLog instance = new StatusLog(); private HashSet<String> toship = new HashSet<String>(); private SimpleDateFormat filedate; @@ -49,6 +52,7 @@ public class StatusLog { try { filedate = new SimpleDateFormat("-yyyyMMddHHmm"); } catch (Exception e) { + eelfLogger.error("Exception", e); } } @@ -104,6 +108,7 @@ public class StatusLog { def = best * 1000; } } catch (Exception e) { + eelfLogger.error("Exception", e); } return (def); } @@ -133,6 +138,7 @@ public class StatusLog { try { instance.checkRoll(System.currentTimeMillis()); } catch (Exception e) { + eelfLogger.error("Exception", e); } return (instance.curfile); } @@ -149,6 +155,7 @@ public class StatusLog { os.write((NodeUtils.logts(new Date(now)) + '|' + s + '\n').getBytes()); os.flush(); } catch (IOException ioe) { + eelfLogger.error("IOException", ioe); } } diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java index 6dc334fc..fa868b26 100644 --- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java +++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java @@ -45,20 +45,18 @@ public class DeliveryQueueTest { DeliveryQueueHelper deliveryQueueHelper; private String dirPath = "/tmp/dir001/"; - private String FileName1 = "10000000000004.fileName.M"; + private String fileName = "10000000000004.fileName.M"; @Before public void setUp() { - when(destInfo.getSpool()).thenReturn("tmp"); + when(destInfo.getSpool()).thenReturn(dirPath); deliveryQueue = new DeliveryQueue(deliveryQueueHelper, destInfo); } @Test public void Given_New_DeliveryQueue_Directory_Is_Created_As_Defined_By_DestInfo() { - when(destInfo.getSpool()).thenReturn("tmp"); - File file = new File("tmp"); + File file = new File("/tmp"); assertTrue(file.exists()); - deleteFile("tmp"); } @Test @@ -75,7 +73,7 @@ public class DeliveryQueueTest { deliveryQueue = new DeliveryQueue(deliveryQueueHelper, destInfo); DeliveryTask nt = deliveryQueue.getNext(); assertEquals("10000000000004.fileName", nt.getPublishId()); - deleteFile(dirPath + FileName1); + deleteFile(dirPath + fileName); deleteFile(dirPath); } @@ -87,9 +85,7 @@ public class DeliveryQueueTest { private void prepareFiles() throws Exception { createFolder(dirPath); - createFile(FileName1, dirPath); - String[] files = new String[2]; - files[0] = dirPath + FileName1; + createFile(fileName, dirPath); } private void createFolder(String dirName) { diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTest.java index efa43e11..08120073 100644 --- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTest.java +++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryTest.java @@ -97,7 +97,10 @@ public class DeliveryTest { private DestInfo[] createDestInfoObjects() { DestInfo[] destInfos = new DestInfo[1]; - DestInfo destInfo = new DestInfo("node.datarouternew.com", "spool/s/0/1", "1", "logs/", "/subs/1", "user1", "Basic dXNlcjE6cGFzc3dvcmQx", false, true, false, false, false); + DestInfo destInfo = new DestInfo.DestInfoBuilder().setName("node.datarouternew.com").setSpool("spool/s/0/1").setSubid("1") + .setLogdata("logs/").setUrl("/subs/1").setAuthuser("user1").setAuthentication("Basic dXNlcjE6cGFzc3dvcmQx") + .setMetaonly(false).setUse100(true).setPrivilegedSubscriber(false).setFollowRedirects(false) + .setDecompress(false).createDestInfo(); destInfos[0] = destInfo; return destInfos; } diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigTest.java index 7dddd67a..5e357373 100644 --- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigTest.java +++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigTest.java @@ -36,7 +36,8 @@ import java.io.Reader; import java.io.StringReader; @RunWith(PowerMockRunner.class) -@SuppressStaticInitializationFor({"org.onap.dmaap.datarouter.node.ProvData", "org.onap.dmaap.datarouter.node.NodeUtils"}) +@SuppressStaticInitializationFor({"org.onap.dmaap.datarouter.node.ProvData", + "org.onap.dmaap.datarouter.node.NodeUtils"}) public class NodeConfigTest { private static NodeConfig nodeConfig; @@ -72,7 +73,7 @@ public class NodeConfigTest { } @Test - public void Given_SubId_Then_Get_Feed_Id_Returns_Correct_Id() { + public void Given_SubId_Then_Get_Feed_Id_Returns_Correct_Id(){ String feedId = nodeConfig.getFeedId("1"); Assert.assertEquals("1", feedId); } @@ -134,13 +135,15 @@ public class NodeConfigTest { @Test public void Given_Same_Ip_Then_Is_Another_Node_Returns_False() { - Boolean isAnotherNode = nodeConfig.isAnotherNode("Basic MTcyLjAuMC40OmtCTmhkWVFvbzhXNUphZ2g4T1N4Zmp6Mzl1ND0=", "172.0.0.1"); + Boolean isAnotherNode = + nodeConfig.isAnotherNode("Basic MTcyLjAuMC40OmtCTmhkWVFvbzhXNUphZ2g4T1N4Zmp6Mzl1ND0=", "172.0.0.1"); Assert.assertFalse(isAnotherNode); } @Test public void Given_Different_Ip_Then_Is_Another_Node_Returns_True() { - Boolean isAnotherNode = nodeConfig.isAnotherNode("Basic MTcyLjAuMC40OmtCTmhkWVFvbzhXNUphZ2g4T1N4Zmp6Mzl1ND0=", "172.0.0.4"); + Boolean isAnotherNode = + nodeConfig.isAnotherNode("Basic MTcyLjAuMC40OmtCTmhkWVFvbzhXNUphZ2g4T1N4Zmp6Mzl1ND0=", "172.0.0.4"); Assert.assertTrue(isAnotherNode); } 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()));
diff --git a/datarouter-subscriber/pom.xml b/datarouter-subscriber/pom.xml index 0182362c..6c577a32 100755 --- a/datarouter-subscriber/pom.xml +++ b/datarouter-subscriber/pom.xml @@ -89,10 +89,6 @@ <version>1.2.17</version> <scope>compile</scope> </dependency> - <dependency> - <groupId>com.thoughtworks.xstream</groupId> - <artifactId>xstream</artifactId> - </dependency> </dependencies> <profiles> <profile> diff --git a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServlet.java b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServlet.java index 315207eb..e9a0bf9b 100644 --- a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServlet.java +++ b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServlet.java @@ -63,7 +63,7 @@ public class SampleSubscriberServlet extends HttpServlet { try { Files.createDirectory(Paths.get(outputDirectory)); } catch (IOException e) { - logger.info("SubServlet: Failed to create delivery dir: " + e.getMessage()); + logger.info("SubServlet: Failed to create delivery dir: " + e.getMessage(), e); } basicAuth = "Basic " + Base64.encodeBase64String((login + ":" + password).getBytes()); } diff --git a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberProps.java b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberProps.java index 329c06a5..f05ca5d4 100644 --- a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberProps.java +++ b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberProps.java @@ -45,7 +45,7 @@ public class SubscriberProps { try { instance = new SubscriberProps(propsPath); } catch (IOException ioe) { - subLogger.error("IO Exception: " + ioe.getMessage()); + subLogger.error("IO Exception: " + ioe.getMessage(), ioe); } } return instance; diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 12014e69..c701eeb5 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -7,34 +7,40 @@ Release-notes ============== -Version: 2.0.1 (Dublin) +Version: 2.1.0 (Dublin) --------------------------- -:Release Date: 2019-02-28 +:Release Date: 2019-05-30 The DataRouter(DR) provisioning API is a HTTPS-based, REST-like API for creating and managing DR feeds and subscriptions. New Features: -+--------------+------------------------------------------------------------------+ -| JIRA ID | Description | -+==============+==================================================================+ -| DMAAP-988 | Update to new oparent | -+--------------+------------------------------------------------------------------+ ++--------------+-------------------------------------------------------------------------------+ +| JIRA ID | Description | ++==============+===============================================================================+ +| DMAAP-978 | [DR] Query of publication history (new API) for use by Data File Collector) | ++--------------+-------------------------------------------------------------------------------+ +| DMAAP-980 | [DR] Optional consumer compression feed handling | ++--------------+-------------------------------------------------------------------------------+ +| DMAAP-1016 | DR provisioning AAF integration | ++--------------+-------------------------------------------------------------------------------+ Bug Fixes: +----------------+--------------------------------------------------------------------------------------------------+ | JIRA ID | Description | +================+==================================================================================================+ -| DMAAP-964 | DMAAP deployment failures starting 20190115 on casablanca branch | +| DMAAP-964 | [DMAAP] DMAAP deployment failures starting 20190115 on casablanca branch | ++----------------+--------------------------------------------------------------------------------------------------+ +| DMAAP-1010 | [DR] DMaaP Data Router fails healthcheck | +----------------+--------------------------------------------------------------------------------------------------+ -| DMAAP-1047 | Data Router docker version missing explicit version number | +| DMAAP-1047 | [DR] Data Router docker version missing explicit version number | +----------------+--------------------------------------------------------------------------------------------------+ | DMAAP-1048 | [DR] AAF certs expired on dmaap-dr-prov and dmaap-dr-node | +----------------+--------------------------------------------------------------------------------------------------+ -| DMAAP-1064 | [DR] Update datarouter POM version following AAF cert updates | +| DMAAP-1161 | [DR] filebeat container on DR-Node and DR-Prov are unable to publish to kibana | +----------------+--------------------------------------------------------------------------------------------------+ Known Issues @@ -85,7 +85,6 @@ <sl4j-api.version>1.7.25</sl4j-api.version> <hamcrest-lib.version>1.3</hamcrest-lib.version> <annotations.version>12.0</annotations.version> - <xstream.version>1.4.10</xstream.version> </properties> <modules> <module>datarouter-prov</module> @@ -204,6 +203,10 @@ <groupId>org.databene</groupId> <artifactId>contiperf</artifactId> </exclusion> + <exclusion> + <groupId>com.thoughtworks.xstream</groupId> + <artifactId>xstream</artifactId> + </exclusion> </exclusions> </dependency> <dependency> @@ -257,11 +260,6 @@ <artifactId>json</artifactId> <version>${json.version}</version> </dependency> - <dependency> - <groupId>com.thoughtworks.xstream</groupId> - <artifactId>xstream</artifactId> - <version>${xstream.version}</version> - </dependency> </dependencies> </dependencyManagement> <build> |