aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INFO.yaml14
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilter.java4
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java19
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryQueue.java4
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java4
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/IsFrom.java6
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/LogManager.java10
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java18
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java6
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java13
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java6
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/RedirManager.java8
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java7
-rw-r--r--datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java14
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java26
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java35
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java24
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java34
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java2
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java25
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java17
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java27
22 files changed, 191 insertions, 132 deletions
diff --git a/INFO.yaml b/INFO.yaml
index 419d763b..df9e87a7 100644
--- a/INFO.yaml
+++ b/INFO.yaml
@@ -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
@@ -69,7 +69,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:
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/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 78a195b1..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);
@@ -117,6 +120,7 @@ public class LogManager extends TimerTask {
try {
wait(10000);
} catch (Exception e) {
+ logger.error("InterruptedException", e);
}
}
@@ -148,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()) {
@@ -161,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);
}
}
}
@@ -173,6 +179,7 @@ public class LogManager extends TimerTask {
(new File(uploaddir + "/.meta")).delete();
w.write(lastqueued + "\n");
} catch (Exception e) {
+ logger.error("Exception", e);
}
}
}
@@ -189,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/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-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;