summaryrefslogtreecommitdiffstats
path: root/datarouter-prov/src/main
diff options
context:
space:
mode:
authorRam Koya <rk541m@att.com>2018-09-25 13:21:24 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-25 13:21:24 +0000
commit233898bab542c5425af9f6240955bad3904f9838 (patch)
tree75eb24d92aa1ab15b5af09956b163ad476d28b10 /datarouter-prov/src/main
parent67b1f764c52c684df62b90936f9acf2cfe5c39c4 (diff)
parent585e50efa6503595ae245a8f07ba042d2ba6a3f4 (diff)
Merge "Fix Main Vulnerabilities"
Diffstat (limited to 'datarouter-prov/src/main')
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java12
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java18
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java18
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/InternalServlet.java32
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java16
-rwxr-xr-xdatarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/ProxyServlet.java71
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/RouteServlet.java18
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java14
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java24
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java26
10 files changed, 79 insertions, 170 deletions
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 d7da4dc1..68c81d84 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
@@ -90,11 +90,7 @@ public class DRFeedsServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doGet(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
- }
+ super.doGet(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
@@ -211,11 +207,7 @@ public class DRFeedsServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doPost(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
- }
+ super.doPost(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
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 d2452e7d..827f0091 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
@@ -75,11 +75,7 @@ public class FeedServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doDelete(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
- }
+ super.doDelete(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
@@ -155,11 +151,7 @@ public class FeedServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doGet(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
- }
+ super.doGet(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
@@ -230,11 +222,7 @@ public class FeedServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doPut(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
- }
+ super.doPut(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
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 96a9924f..17a1d752 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
@@ -75,11 +75,7 @@ public class GroupServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doGet(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
- }
+ super.doGet(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
@@ -165,11 +161,7 @@ public class GroupServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doPut(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
- }
+ super.doPut(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
@@ -288,11 +280,7 @@ public class GroupServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doPost(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
- }
+ super.doPost(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
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 685d5528..0d8ed66f 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
@@ -182,11 +182,7 @@ public class InternalServlet extends ProxyServlet {
String path = req.getPathInfo();
if (path.startsWith("/api/")) {
if (isProxyOK(req) && isProxyServer()) {
- try {
- super.doDelete(req, resp);
- } catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
- }
+ super.doDelete(req, resp);
return;
}
String key = path.substring(5);
@@ -253,12 +249,8 @@ public class InternalServlet extends ProxyServlet {
}
if (path.equals("/prov")) {
if (isProxyOK(req) && isProxyServer()) {
- try {
- if (super.doGetWithFallback(req, resp)) {
- return;
- }
- } catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
+ if (super.doGetWithFallback(req, resp)) {
+ return;
}
// fall back to returning the local data if the remote is unreachable
intlogger.info("Active server unavailable; falling back to local copy.");
@@ -305,11 +297,7 @@ public class InternalServlet extends ProxyServlet {
}
if (path.startsWith("/api/")) {
if (isProxyOK(req) && isProxyServer()) {
- try {
- super.doGet(req, resp);
- } catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
- }
+ super.doGet(req, resp);
return;
}
String key = path.substring(5);
@@ -361,11 +349,7 @@ public class InternalServlet extends ProxyServlet {
String path = req.getPathInfo();
if (path.startsWith("/api/")) {
if (isProxyOK(req) && isProxyServer()) {
- try {
- super.doPut(req, resp);
- } catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
- }
+ super.doPut(req, resp);
return;
}
String key = path.substring(5);
@@ -414,11 +398,7 @@ public class InternalServlet extends ProxyServlet {
String path = req.getPathInfo();
if (path.startsWith("/api/")) {
if (isProxyOK(req) && isProxyServer()) {
- try {
- super.doPost(req, resp);
- } catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
- }
+ super.doPost(req, resp);
return;
}
String key = path.substring(5);
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 5d799eee..651d7316 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
@@ -90,9 +90,9 @@ public class Main {
public static final String DEFAULT_TRUSTSTORE = "/opt/java/jdk/jdk180/jre/lib/security/cacerts";
public static final String KEYSTORE_TYPE_PROPERTY = "org.onap.dmaap.datarouter.provserver.keystore.type";
public static final String KEYSTORE_PATH_PROPERTY = "org.onap.dmaap.datarouter.provserver.keystore.path";
- public static final String KEYSTORE_PASSWORD_PROPERTY = "org.onap.dmaap.datarouter.provserver.keystore.password";
+ public static final String KEYSTORE_PASS_PROPERTY = "org.onap.dmaap.datarouter.provserver.keystore.password";
public static final String TRUSTSTORE_PATH_PROPERTY = "org.onap.dmaap.datarouter.provserver.truststore.path";
- public static final String TRUSTSTORE_PASSWORD_PROPERTY = "org.onap.dmaap.datarouter.provserver.truststore.password";
+ public static final String TRUSTSTORE_PASS_PROPERTY = "org.onap.dmaap.datarouter.provserver.truststore.password";
/**
* The one and only {@link Server} instance in this JVM
@@ -110,7 +110,7 @@ public class Main {
Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
// Check DB is accessible and contains the expected tables
- if (!checkDatabase(logger)) {
+ if (!checkDatabase()) {
System.exit(1);
}
@@ -154,7 +154,7 @@ public class Main {
// HTTPS connector
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStorePath(p.getProperty(KEYSTORE_PATH_PROPERTY));
- sslContextFactory.setKeyStorePassword(p.getProperty(KEYSTORE_PASSWORD_PROPERTY));
+ sslContextFactory.setKeyStorePassword(p.getProperty(KEYSTORE_PASS_PROPERTY));
sslContextFactory
.setKeyManagerPassword(p.getProperty("org.onap.dmaap.datarouter.provserver.keymanager.password"));
// SSL stuff
@@ -172,15 +172,15 @@ public class Main {
sslContextFactory.setKeyStoreType(p.getProperty(KEYSTORE_TYPE_PROPERTY, "jks"));
sslContextFactory.setKeyStorePath(p.getProperty(KEYSTORE_PATH_PROPERTY));
- sslContextFactory.setKeyStorePassword(p.getProperty(KEYSTORE_PASSWORD_PROPERTY));
+ sslContextFactory.setKeyStorePassword(p.getProperty(KEYSTORE_PASS_PROPERTY));
sslContextFactory
.setKeyManagerPassword(p.getProperty("org.onap.dmaap.datarouter.provserver.keymanager.password"));
String ts = p.getProperty(TRUSTSTORE_PATH_PROPERTY);
if (ts != null && ts.length() > 0) {
- System.out.println("@@ TS -> " + ts);
+ logger.info("@@ TS -> " + ts);
sslContextFactory.setTrustStorePath(ts);
- sslContextFactory.setTrustStorePassword(p.getProperty(TRUSTSTORE_PASSWORD_PROPERTY));
+ sslContextFactory.setTrustStorePassword(p.getProperty(TRUSTSTORE_PASS_PROPERTY));
} else {
sslContextFactory.setTrustStorePath(DEFAULT_TRUSTSTORE);
sslContextFactory.setTrustStorePassword("changeit");
@@ -255,7 +255,7 @@ public class Main {
logger.info("PROV0001 **** AT&T Data Router Provisioning Server halted.");
}
- private static boolean checkDatabase(Logger logger) {
+ private static boolean checkDatabase() {
DB db = new DB();
return db.runRetroFits();
}
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 66a9d42b..ca63f466 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
@@ -54,6 +54,8 @@ import org.apache.http.impl.client.DefaultHttpClient;
import org.onap.dmaap.datarouter.provisioning.utils.DB;
import org.onap.dmaap.datarouter.provisioning.utils.URLUtilities;
+import static org.onap.dmaap.datarouter.provisioning.utils.HttpServletUtils.sendResponseError;
+
/**
* This class is the base class for those servlets that need to proxy their requests from the standby to active server.
* Its methods perform the proxy function to the active server. If the active server is not reachable, a 503
@@ -80,11 +82,11 @@ public class ProxyServlet extends BaseServlet {
Properties props = (new DB()).getProperties();
String type = props.getProperty(Main.KEYSTORE_TYPE_PROPERTY, "jks");
String store = props.getProperty(Main.KEYSTORE_PATH_PROPERTY);
- String pass = props.getProperty(Main.KEYSTORE_PASSWORD_PROPERTY);
+ String pass = props.getProperty(Main.KEYSTORE_PASS_PROPERTY);
KeyStore keyStore = readStore(store, pass, type);
store = props.getProperty(Main.TRUSTSTORE_PATH_PROPERTY);
- pass = props.getProperty(Main.TRUSTSTORE_PASSWORD_PROPERTY);
+ pass = props.getProperty(Main.TRUSTSTORE_PASS_PROPERTY);
if (store == null || store.length() == 0) {
store = Main.DEFAULT_TRUSTSTORE;
pass = "changeit";
@@ -94,12 +96,12 @@ public class ProxyServlet extends BaseServlet {
// We are connecting with the node name, but the certificate will have the CNAME
// So we need to accept a non-matching certificate name
SSLSocketFactory socketFactory = new SSLSocketFactory(keyStore,
- props.getProperty(Main.KEYSTORE_PASSWORD_PROPERTY), trustStore);
+ props.getProperty(Main.KEYSTORE_PASS_PROPERTY), trustStore);
socketFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
sch = new Scheme("https", 443, socketFactory);
inited = true;
} catch (Exception e) {
- e.printStackTrace();
+ intlogger.error("ProxyServlet: " + e.getMessage());
}
intlogger.info("ProxyServlet: inited = " + inited);
}
@@ -111,7 +113,7 @@ public class ProxyServlet extends BaseServlet {
} catch (FileNotFoundException fileNotFoundException) {
intlogger.error("ProxyServlet: " + fileNotFoundException.getMessage());
} catch (Exception x) {
- System.err.println("READING TRUSTSTORE: " + x);
+ intlogger.error("READING TRUSTSTORE: " + x);
}
return ks;
}
@@ -151,7 +153,7 @@ public class ProxyServlet extends BaseServlet {
* Issue a proxy DELETE to the active provisioning server.
*/
@Override
- public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ public void doDelete(HttpServletRequest req, HttpServletResponse resp) {
doProxy(req, resp, "DELETE");
}
@@ -159,7 +161,7 @@ public class ProxyServlet extends BaseServlet {
* Issue a proxy GET to the active provisioning server.
*/
@Override
- public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ public void doGet(HttpServletRequest req, HttpServletResponse resp) {
doProxy(req, resp, "GET");
}
@@ -167,7 +169,7 @@ public class ProxyServlet extends BaseServlet {
* Issue a proxy PUT to the active provisioning server.
*/
@Override
- public void doPut(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ public void doPut(HttpServletRequest req, HttpServletResponse resp) {
doProxy(req, resp, "PUT");
}
@@ -175,7 +177,7 @@ public class ProxyServlet extends BaseServlet {
* Issue a proxy POST to the active provisioning server.
*/
@Override
- public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ public void doPost(HttpServletRequest req, HttpServletResponse resp) {
doProxy(req, resp, "POST");
}
@@ -185,7 +187,7 @@ public class ProxyServlet extends BaseServlet {
*
* @return true if the proxy succeeded
*/
- public boolean doGetWithFallback(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ public boolean doGetWithFallback(HttpServletRequest req, HttpServletResponse resp) {
boolean rv = false;
if (inited) {
String url = buildUrl(req);
@@ -199,24 +201,17 @@ public class ProxyServlet extends BaseServlet {
copyRequestHeaders(req, proxy);
// Execute the request
- HttpResponse pxy_response = httpclient.execute(proxy);
+ HttpResponse pxyResponse = httpclient.execute(proxy);
// Get response headers and body
- int code = pxy_response.getStatusLine().getStatusCode();
+ int code = pxyResponse.getStatusLine().getStatusCode();
resp.setStatus(code);
- copyResponseHeaders(pxy_response, resp);
-
- HttpEntity entity = pxy_response.getEntity();
- if (entity != null) {
- InputStream in = entity.getContent();
- IOUtils.copy(in, resp.getOutputStream());
- in.close();
- }
+ copyResponseHeaders(pxyResponse, resp);
+ copyEntityContent(pxyResponse, resp);
rv = true;
} catch (IOException e) {
- System.err.println("ProxyServlet: " + e);
- e.printStackTrace();
+ intlogger.error("ProxyServlet: " + e.getMessage());
} finally {
proxy.releaseConnection();
httpclient.getConnectionManager().shutdown();
@@ -228,7 +223,7 @@ public class ProxyServlet extends BaseServlet {
return rv;
}
- private void doProxy(HttpServletRequest req, HttpServletResponse resp, final String method) throws IOException {
+ private void doProxy(HttpServletRequest req, HttpServletResponse resp, final String method) {
if (inited && isProxyServer()) {
String url = buildUrl(req);
intlogger.info("ProxyServlet: proxying " + method + " " + url);
@@ -247,23 +242,16 @@ public class ProxyServlet extends BaseServlet {
}
// Execute the request
- HttpResponse pxy_response = httpclient.execute(proxy);
+ HttpResponse pxyResponse = httpclient.execute(proxy);
// Get response headers and body
- int code = pxy_response.getStatusLine().getStatusCode();
+ int code = pxyResponse.getStatusLine().getStatusCode();
resp.setStatus(code);
- copyResponseHeaders(pxy_response, resp);
-
- HttpEntity entity = pxy_response.getEntity();
- if (entity != null) {
- InputStream in = entity.getContent();
- IOUtils.copy(in, resp.getOutputStream());
- in.close();
- }
+ copyResponseHeaders(pxyResponse, resp);
+ copyEntityContent(pxyResponse, resp);
} catch (IOException e) {
intlogger.warn("ProxyServlet: " + e);
- resp.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
- e.printStackTrace();
+ sendResponseError(resp, HttpServletResponse.SC_SERVICE_UNAVAILABLE, "", intlogger);
} finally {
proxy.releaseConnection();
httpclient.getConnectionManager().shutdown();
@@ -271,7 +259,7 @@ public class ProxyServlet extends BaseServlet {
}
} else {
intlogger.warn("ProxyServlet: proxy disabled");
- resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, intlogger);
}
}
@@ -306,6 +294,17 @@ public class ProxyServlet extends BaseServlet {
}
}
+ private void copyEntityContent(HttpResponse pxyResponse, HttpServletResponse resp) {
+ HttpEntity entity = pxyResponse.getEntity();
+ if (entity != null) {
+ try (InputStream in = entity.getContent()) {
+ IOUtils.copy(in, resp.getOutputStream());
+ } catch (Exception e) {
+ intlogger.error("Exception: " + e.getMessage());
+ }
+ }
+ }
+
public class ProxyHttpRequest extends HttpEntityEnclosingRequestBase {
private final String method;
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 a9b22ec0..12699a49 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
@@ -143,11 +143,7 @@ public class RouteServlet extends ProxyServlet {
return;
}
if (isProxyOK(req) && isProxyServer()) {
- try {
- super.doDelete(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
- }
+ super.doDelete(req, resp);
return;
}
@@ -255,11 +251,7 @@ public class RouteServlet extends ProxyServlet {
return;
}
if (isProxyOK(req) && isProxyServer()) {
- try {
- super.doGet(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException" + ioe.getMessage());
- }
+ super.doGet(req, resp);
return;
}
@@ -355,11 +347,7 @@ public class RouteServlet extends ProxyServlet {
return;
}
if (isProxyOK(req) && isProxyServer()) {
- try {
- super.doPost(req, resp);
- } catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
- }
+ super.doPost(req, resp);
return;
}
String path = req.getPathInfo();
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 e8828f12..1ab45a98 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
@@ -91,11 +91,7 @@ public class SubscribeServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doGet(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException: " + ioe.getMessage());
- }
+ super.doGet(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
@@ -172,7 +168,7 @@ public class SubscribeServlet extends ProxyServlet {
* section in the <b>Provisioning API</b> document for details on how this method should be invoked.
*/
@Override
- public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ public void doPost(HttpServletRequest req, HttpServletResponse resp) {
setIpAndFqdnForEelf("doPost");
eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER));
EventLogRecord elr = new EventLogRecord(req);
@@ -185,11 +181,7 @@ public class SubscribeServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doPost(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException: " + ioe.getMessage());
- }
+ super.doPost(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
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 3bfa7507..5fa370d1 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
@@ -81,11 +81,7 @@ public class SubscriptionServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doDelete(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException: " + ioe.getMessage());
- }
+ super.doDelete(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
@@ -161,11 +157,7 @@ public class SubscriptionServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doGet(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException: " + ioe.getMessage());
- }
+ super.doGet(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
@@ -236,11 +228,7 @@ public class SubscriptionServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doPut(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException: " + ioe.getMessage());
- }
+ super.doPut(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
@@ -390,11 +378,7 @@ public class SubscriptionServlet extends ProxyServlet {
return;
}
if (isProxyServer()) {
- try {
- super.doPost(req, resp);
- } catch (IOException ioe) {
- eventlogger.error("IOException: " + ioe.getMessage());
- }
+ super.doPost(req, resp);
return;
}
String bhdr = req.getHeader(BEHALF_HEADER);
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 f9d0867d..9eece14f 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
@@ -151,14 +151,14 @@ public class SynchronizerTask extends TimerTask {
Properties props = (new DB()).getProperties();
String type = props.getProperty(Main.KEYSTORE_TYPE_PROPERTY, "jks");
String store = props.getProperty(Main.KEYSTORE_PATH_PROPERTY);
- String pass = props.getProperty(Main.KEYSTORE_PASSWORD_PROPERTY);
+ String pass = props.getProperty(Main.KEYSTORE_PASS_PROPERTY);
KeyStore keyStore = KeyStore.getInstance(type);
try(FileInputStream instream = new FileInputStream(new File(store))) {
keyStore.load(instream, pass.toCharArray());
}
store = props.getProperty(Main.TRUSTSTORE_PATH_PROPERTY);
- pass = props.getProperty(Main.TRUSTSTORE_PASSWORD_PROPERTY);
+ pass = props.getProperty(Main.TRUSTSTORE_PASS_PROPERTY);
KeyStore trustStore = null;
if (store != null && store.length() > 0) {
trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
@@ -171,7 +171,7 @@ public class SynchronizerTask extends TimerTask {
// We are connecting with the node name, but the certificate will have the CNAME
// So we need to accept a non-matching certificate name
String keystorepass = props.getProperty(
- Main.KEYSTORE_PASSWORD_PROPERTY); //itrack.web.att.com/browse/DATARTR-6 for changing hard coded passphase ref
+ Main.KEYSTORE_PASS_PROPERTY); //itrack.web.att.com/browse/DATARTR-6 for changing hard coded passphase ref
try(AbstractHttpClient hc = new DefaultHttpClient()) {
SSLSocketFactory socketFactory =
(trustStore == null)
@@ -282,7 +282,6 @@ public class SynchronizerTask extends TimerTask {
}
} catch (Exception e) {
logger.warn("PROV0020: Caught exception in SynchronizerTask: " + e);
- e.printStackTrace();
}
}
@@ -328,7 +327,7 @@ public class SynchronizerTask extends TimerTask {
* Synchronize the Feeds in the JSONArray, with the Feeds in the DB.
*/
private void syncFeeds(JSONArray ja) {
- Collection<Syncable> coll = new ArrayList<Syncable>();
+ Collection<Syncable> coll = new ArrayList<>();
for (int n = 0; n < ja.length(); n++) {
try {
Feed f = new Feed(ja.getJSONObject(n));
@@ -346,7 +345,7 @@ public class SynchronizerTask extends TimerTask {
* Synchronize the Subscriptions in the JSONArray, with the Subscriptions in the DB.
*/
private void syncSubs(JSONArray ja) {
- Collection<Syncable> coll = new ArrayList<Syncable>();
+ Collection<Syncable> coll = new ArrayList<>();
for (int n = 0; n < ja.length(); n++) {
try {
//Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047.
@@ -367,7 +366,7 @@ public class SynchronizerTask extends TimerTask {
* Rally:US708115 - Synchronize the Groups in the JSONArray, with the Groups in the DB.
*/
private void syncGroups(JSONArray ja) {
- Collection<Syncable> coll = new ArrayList<Syncable>();
+ Collection<Syncable> coll = new ArrayList<>();
for (int n = 0; n < ja.length(); n++) {
try {
Group g = new Group(ja.getJSONObject(n));
@@ -386,7 +385,7 @@ public class SynchronizerTask extends TimerTask {
* Synchronize the Parameters in the JSONObject, with the Parameters in the DB.
*/
private void syncParams(JSONObject jo) {
- Collection<Syncable> coll = new ArrayList<Syncable>();
+ Collection<Syncable> coll = new ArrayList<>();
for (String k : jo.keySet()) {
String v = "";
try {
@@ -413,7 +412,7 @@ public class SynchronizerTask extends TimerTask {
}
private void syncIngressRoutes(JSONArray ja) {
- Collection<Syncable> coll = new ArrayList<Syncable>();
+ Collection<Syncable> coll = new ArrayList<>();
for (int n = 0; n < ja.length(); n++) {
try {
IngressRoute in = new IngressRoute(ja.getJSONObject(n));
@@ -428,7 +427,7 @@ public class SynchronizerTask extends TimerTask {
}
private void syncEgressRoutes(JSONObject jo) {
- Collection<Syncable> coll = new ArrayList<Syncable>();
+ Collection<Syncable> coll = new ArrayList<>();
for (String key : jo.keySet()) {
try {
int sub = Integer.parseInt(key);
@@ -447,7 +446,7 @@ public class SynchronizerTask extends TimerTask {
}
private void syncNetworkRoutes(JSONArray ja) {
- Collection<Syncable> coll = new ArrayList<Syncable>();
+ Collection<Syncable> coll = new ArrayList<>();
for (int n = 0; n < ja.length(); n++) {
try {
NetworkRoute nr = new NetworkRoute(ja.getJSONObject(n));
@@ -466,7 +465,7 @@ public class SynchronizerTask extends TimerTask {
try {
Map<String, Syncable> newmap = getMap(newc);
Map<String, Syncable> oldmap = getMap(oldc);
- Set<String> union = new TreeSet<String>(newmap.keySet());
+ Set<String> union = new TreeSet<>(newmap.keySet());
union.addAll(oldmap.keySet());
DB db = new DB();
@SuppressWarnings("resource")
@@ -503,13 +502,12 @@ public class SynchronizerTask extends TimerTask {
db.release(conn);
} catch (SQLException e) {
logger.warn("PROV5009: problem during sync, exception: " + e);
- e.printStackTrace();
}
return changes;
}
private Map<String, Syncable> getMap(Collection<? extends Syncable> c) {
- Map<String, Syncable> map = new HashMap<String, Syncable>();
+ Map<String, Syncable> map = new HashMap<>();
for (Syncable v : c) {
map.put(v.getKey(), v);
}