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 92e52fc..6ed5d8b 100644
--- 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
@@ -79,132 +79,194 @@
 import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeMultipart;
+
 /**
- * This is the base class for all Servlets in the provisioning code.
- * It provides standard constants and some common methods.
+ * This is the base class for all Servlets in the provisioning code. It provides standard constants and some common
+ * methods.
  *
  * @author Robert Eby
  * @version $Id: BaseServlet.java,v 1.16 2014/03/12 19:45:40 eby Exp $
  */
 @SuppressWarnings("serial")
 public class BaseServlet extends HttpServlet implements ProvDataProvider {
-    public static final String BEHALF_HEADER         = "X-ATT-DR-ON-BEHALF-OF";
-    public static final String FEED_BASECONTENT_TYPE = "application/vnd.att-dr.feed";
-    public static final String FEED_CONTENT_TYPE     = "application/vnd.att-dr.feed; version=2.0";
+
+    public static final String BEHALF_HEADER = "X-ATT-DR-ON-BEHALF-OF";
+    static final String FEED_BASECONTENT_TYPE = "application/vnd.att-dr.feed";
+    public static final String FEED_CONTENT_TYPE = "application/vnd.att-dr.feed; version=2.0";
     public static final String FEEDFULL_CONTENT_TYPE = "application/vnd.att-dr.feed-full; version=2.0";
     public static final String FEEDLIST_CONTENT_TYPE = "application/vnd.att-dr.feed-list; version=1.0";
-    public static final String SUB_BASECONTENT_TYPE  = "application/vnd.att-dr.subscription";
-    public static final String SUB_CONTENT_TYPE      = "application/vnd.att-dr.subscription; version=2.0";
-    public static final String SUBFULL_CONTENT_TYPE  = "application/vnd.att-dr.subscription-full; version=2.0";
-    public static final String SUBLIST_CONTENT_TYPE  = "application/vnd.att-dr.subscription-list; version=1.0";
+    static final String SUB_BASECONTENT_TYPE = "application/vnd.att-dr.subscription";
+    public static final String SUB_CONTENT_TYPE = "application/vnd.att-dr.subscription; version=2.0";
+    public static final String SUBFULL_CONTENT_TYPE = "application/vnd.att-dr.subscription-full; version=2.0";
+    static final String SUBLIST_CONTENT_TYPE = "application/vnd.att-dr.subscription-list; version=1.0";
 
 
     //Adding groups functionality, ...1610
-    public static final String GROUP_BASECONTENT_TYPE = "application/vnd.att-dr.group";
-    public static final String GROUP_CONTENT_TYPE     = "application/vnd.att-dr.group; version=2.0";
-    public static final String GROUPFULL_CONTENT_TYPE = "application/vnd.att-dr.group-full; version=2.0";
+    static final String GROUP_BASECONTENT_TYPE = "application/vnd.att-dr.group";
+    public static final String GROUP_CONTENT_TYPE = "application/vnd.att-dr.group; version=2.0";
+    static final String GROUPFULL_CONTENT_TYPE = "application/vnd.att-dr.group-full; version=2.0";
     public static final String GROUPLIST_CONTENT_TYPE = "application/vnd.att-dr.fegrouped-list; version=1.0";
 
 
-    public static final String LOGLIST_CONTENT_TYPE  = "application/vnd.att-dr.log-list; version=1.0";
+    public static final String LOGLIST_CONTENT_TYPE = "application/vnd.att-dr.log-list; version=1.0";
     public static final String PROVFULL_CONTENT_TYPE1 = "application/vnd.att-dr.provfeed-full; version=1.0";
     public static final String PROVFULL_CONTENT_TYPE2 = "application/vnd.att-dr.provfeed-full; version=2.0";
-    public static final String CERT_ATTRIBUTE        = "javax.servlet.request.X509Certificate";
+    public static final String CERT_ATTRIBUTE = "javax.servlet.request.X509Certificate";
 
-    public static final String DB_PROBLEM_MSG = "There has been a problem with the DB.  It is suggested you try the operation again.";
+    static final String DB_PROBLEM_MSG = "There has been a problem with the DB.  It is suggested you try the operation again.";
 
-    public static final int    DEFAULT_MAX_FEEDS     = 10000;
-    public static final int    DEFAULT_MAX_SUBS      = 100000;
-    public static final int    DEFAULT_POKETIMER1    = 5;
-    public static final int    DEFAULT_POKETIMER2    = 30;
-    public static final String DEFAULT_DOMAIN        = "web.att.com";
-    public static final String DEFAULT_PROVSRVR_NAME = "feeds-drtr.web.att.com";
-    public static final String RESEARCH_SUBNET       = "135.207.136.128/25";
-    public static final String STATIC_ROUTING_NODES       = ""; //Adding new param for static Routing - Rally:US664862-1610
+    private static final int DEFAULT_MAX_FEEDS = 10000;
+    private static final int DEFAULT_MAX_SUBS = 100000;
+    private static final int DEFAULT_POKETIMER1 = 5;
+    private static final int DEFAULT_POKETIMER2 = 30;
+    private static final String DEFAULT_DOMAIN = "onap";
+    private static final String DEFAULT_PROVSRVR_NAME = "dmaap-dr-prov";
+    private static final String RESEARCH_SUBNET = "10.42.0.0/16";
+    private static final String STATIC_ROUTING_NODES = ""; //Adding new param for static Routing - Rally:US664862-1610
 
-    /** A boolean to trigger one time "provisioning changed" event on startup */
-    private static boolean startmsg_flag  = true;
-    /** This POD should require SSL connections from clients; pulled from the DB (PROV_REQUIRE_SECURE) */
-    private static boolean require_secure = true;
-    /** This POD should require signed, recognized certificates from clients; pulled from the DB (PROV_REQUIRE_CERT) */
-    private static boolean require_cert   = true;
-    /** The set of authorized addresses and networks; pulled from the DB (PROV_AUTH_ADDRESSES) */
+    /**
+     * A boolean to trigger one time "provisioning changed" event on startup
+     */
+    private static boolean startmsgFlag = true;
+    /**
+     * This POD should require SSL connections from clients; pulled from the DB (PROV_REQUIRE_SECURE)
+     */
+    private static boolean requireSecure = true;
+    /**
+     * This POD should require signed, recognized certificates from clients; pulled from the DB (PROV_REQUIRE_CERT)
+     */
+    private static boolean requireCert = true;
+    /**
+     * The set of authorized addresses and networks; pulled from the DB (PROV_AUTH_ADDRESSES)
+     */
     private static Set<String> authorizedAddressesAndNetworks = new HashSet<String>();
-    /** The set of authorized names; pulled from the DB (PROV_AUTH_SUBJECTS) */
+    /**
+     * The set of authorized names; pulled from the DB (PROV_AUTH_SUBJECTS)
+     */
     private static Set<String> authorizedNames = new HashSet<String>();
-    /** The FQDN of the initially "active" provisioning server in this Data Router ecosystem */
-    private static String initial_active_pod;
-    /** The FQDN of the initially "standby" provisioning server in this Data Router ecosystem */
-    private static String initial_standby_pod;
-    /** The FQDN of this provisioning server in this Data Router ecosystem */
-    private static String this_pod;
-    /** "Timer 1" - used to determine when to notify nodes of provisioning changes */
-    private static long poke_timer1;
-    /** "Timer 2" - used to determine when to notify nodes of provisioning changes */
-    private static long poke_timer2;
-    /** Array of nodes names and/or FQDNs */
+    /**
+     * The FQDN of the initially "active" provisioning server in this Data Router ecosystem
+     */
+    private static String initialActivePod;
+    /**
+     * The FQDN of the initially "standby" provisioning server in this Data Router ecosystem
+     */
+    private static String initialStandbyPod;
+    /**
+     * The FQDN of this provisioning server in this Data Router ecosystem
+     */
+    private static String thisPod;
+    /**
+     * "Timer 1" - used to determine when to notify nodes of provisioning changes
+     */
+    private static long pokeTimer1;
+    /**
+     * "Timer 2" - used to determine when to notify nodes of provisioning changes
+     */
+    private static long pokeTimer2;
+    /**
+     * Array of nodes names and/or FQDNs
+     */
     private static String[] nodes = new String[0];
-    /** Array of node IP addresses */
+    /**
+     * Array of node IP addresses
+     */
     private static InetAddress[] nodeAddresses = new InetAddress[0];
-    /** Array of POD IP addresses */
+    /**
+     * Array of POD IP addresses
+     */
     private static InetAddress[] podAddresses = new InetAddress[0];
-    /** The maximum number of feeds allowed; pulled from the DB (PROV_MAXFEED_COUNT) */
-    protected static int max_feeds    = 0;
-    /** The maximum number of subscriptions allowed; pulled from the DB (PROV_MAXSUB_COUNT) */
-    protected static int max_subs     = 0;
-    /** The current number of feeds in the system */
-    protected static int active_feeds = 0;
-    /** The current number of subscriptions in the system */
-    protected static int active_subs  = 0;
-    /** The domain used to generate a FQDN from the "bare" node names */
-    public static String prov_domain = "web.att.com";
-    /** The standard FQDN of the provisioning server in this Data Router ecosystem */
-    public static String prov_name   = "feeds-drtr.web.att.com";
-    /** The standard FQDN of the ACTIVE provisioning server in this Data Router ecosystem */
-    public static String active_prov_name   = "feeds-drtr.web.att.com";
-    /** Special subnet that is allowed access to /internal */
-    protected static String special_subnet = RESEARCH_SUBNET;
+    /**
+     * The maximum number of feeds allowed; pulled from the DB (PROV_MAXFEED_COUNT)
+     */
+    static int maxFeeds = 0;
+    /**
+     * The maximum number of subscriptions allowed; pulled from the DB (PROV_MAXSUB_COUNT)
+     */
+    static int maxSubs = 0;
+    /**
+     * The current number of feeds in the system
+     */
+    static int activeFeeds = 0;
+    /**
+     * The current number of subscriptions in the system
+     */
+    static int activeSubs = 0;
+    /**
+     * The domain used to generate a FQDN from the "bare" node names
+     */
+    private static String provDomain = "web.att.com";
+    /**
+     * The standard FQDN of the provisioning server in this Data Router ecosystem
+     */
+    public static String provName = "feeds-drtr.web.att.com";
+    /**
+     * The standard FQDN of the ACTIVE provisioning server in this Data Router ecosystem
+     */
+    public static String activeProvName = "feeds-drtr.web.att.com";
+    /**
+     * Special subnet that is allowed access to /internal
+     */
+    private static String researchSubnet = RESEARCH_SUBNET;
+    /**
+     * Special subnet that is allowed access to /internal to Lab Machine
+     */
+    private static String researchSubnet1 = RESEARCH_SUBNET;
+    private static String staticRoutingNodes = STATIC_ROUTING_NODES; //Adding new param for static Routing - Rally:US664862-1610
 
-    /** Special subnet that is allowed access to /internal to Lab Machine */
-    protected static String special_subnet_secondary = RESEARCH_SUBNET;
-    protected static String static_routing_nodes = STATIC_ROUTING_NODES; //Adding new param for static Routing - Rally:US664862-1610
-
-    /** This logger is used to log provisioning events */
+    /**
+     * This logger is used to log provisioning events
+     */
     protected static Logger eventlogger;
-    /** This logger is used to log internal events (errors, etc.) */
+    /**
+     * This logger is used to log internal events (errors, etc.)
+     */
     protected static Logger intlogger;
-    /** Authorizer - interface to the Policy Engine */
+    /**
+     * Authorizer - interface to the Policy Engine
+     */
     protected static Authorizer authz;
-    /** The Synchronizer used to sync active DB to standby one */
-    protected static SynchronizerTask synctask = null;
+    /**
+     * The Synchronizer used to sync active DB to standby one
+     */
+    private static SynchronizerTask synctask = null;
 
     //Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047.
     private InetAddress thishost;
     private InetAddress loopback;
     private static Boolean mailSendFlag = false;
 
-    public static final String MAILCONFIG_FILE = "mail.properties";
+    private static final String MAILCONFIG_FILE = "mail.properties";
     private static Properties mailprops;
+
+    //DMAAP-597 (Tech Dept) REST request source IP auth relaxation to accommodate OOM kubernetes deploy
+    private static String isAddressAuthEnabled = (new DB()).getProperties()
+        .getProperty("org.onap.dmaap.datarouter.provserver.isaddressauthenabled", "false");
+
     /**
      * Initialize data common to all the provisioning server servlets.
      */
     protected BaseServlet() {
-        if (eventlogger == null)
+        if (eventlogger == null) {
             eventlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.events");
-        if (intlogger == null)
-            intlogger   = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
-        if (authz == null)
+        }
+        if (intlogger == null) {
+            intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
+        }
+        if (authz == null) {
             authz = new ProvAuthorizer(this);
-        if (startmsg_flag) {
-            startmsg_flag = false;
+        }
+        if (startmsgFlag) {
+            startmsgFlag = false;
             provisioningParametersChanged();
         }
         if (synctask == null) {
             synctask = SynchronizerTask.getSynchronizer();
         }
         String name = this.getClass().getName();
-        intlogger.info("PROV0002 Servlet "+name+" started.");
+        intlogger.info("PROV0002 Servlet " + name + " started.");
     }
+
     @Override
     public void init(ServletConfig config) throws ServletException {
         super.init(config);
@@ -216,43 +278,52 @@
             // ignore
         }
     }
-    protected int getIdFromPath(HttpServletRequest req) {
+
+    int getIdFromPath(HttpServletRequest req) {
         String path = req.getPathInfo();
-        if (path == null || path.length() < 2)
+        if (path == null || path.length() < 2) {
             return -1;
+        }
         try {
             return Integer.parseInt(path.substring(1));
         } catch (NumberFormatException e) {
             return -1;
         }
     }
+
     /**
      * Read the request's input stream and return a JSONObject from it
+     *
      * @param req the HTTP request
      * @return the JSONObject, or null if the stream cannot be parsed
      */
-    protected JSONObject getJSONfromInput(HttpServletRequest req) {
+    JSONObject getJSONfromInput(HttpServletRequest req) {
         JSONObject jo = null;
         try {
             jo = new JSONObject(new JSONTokener(req.getInputStream()));
-            if (intlogger.isDebugEnabled())
-                intlogger.debug("JSON: "+jo.toString());
+            if (intlogger.isDebugEnabled()) {
+                intlogger.debug("JSON: " + jo.toString());
+            }
         } catch (Exception e) {
-            intlogger.info("Error reading JSON: "+e);
+            intlogger.info("Error reading JSON: " + e);
         }
         return jo;
     }
+
     /**
-     * Check if the remote host is authorized to perform provisioning.
-     * Is the request secure?
-     * Is it coming from an authorized IP address or network (configured via PROV_AUTH_ADDRESSES)?
-     * Does it have a valid client certificate (configured via PROV_AUTH_SUBJECTS)?
+     * Check if the remote host is authorized to perform provisioning. Is the request secure? Is it coming from an
+     * authorized IP address or network (configured via PROV_AUTH_ADDRESSES)? Does it have a valid client certificate
+     * (configured via PROV_AUTH_SUBJECTS)?
+     *
      * @param request the request
      * @return an error string, or null if all is OK
      */
-    protected String isAuthorizedForProvisioning(HttpServletRequest request) {
+    String isAuthorizedForProvisioning(HttpServletRequest request) {
+        if (Boolean.parseBoolean(isAddressAuthEnabled)) {
+            return null;
+        }
         // Is the request https?
-        if (require_secure && !request.isSecure()) {
+        if (requireSecure && !request.isSecure()) {
             return "Request must be made over an HTTPS connection.";
         }
 
@@ -265,14 +336,14 @@
                 found |= addressMatchesNetwork(ip, addrnet);
             }
             if (!found) {
-                return "Unauthorized address: "+remote;
+                return "Unauthorized address: " + remote;
             }
         } catch (UnknownHostException e) {
-            return "Unauthorized address: "+remote;
+            return "Unauthorized address: " + remote;
         }
 
         // Does remote have a valid certificate?
-        if (require_cert) {
+        if (requireCert) {
             X509Certificate certs[] = (X509Certificate[]) request.getAttribute(CERT_ATTRIBUTE);
             if (certs == null || certs.length == 0) {
                 return "Client certificate is missing.";
@@ -288,139 +359,159 @@
         // No problems!
         return null;
     }
+
     /**
      * Check if the remote IP address is authorized to see the /internal URL tree.
+     *
      * @param request the HTTP request
      * @return true iff authorized
      */
-    protected boolean isAuthorizedForInternal(HttpServletRequest request) {
+    boolean isAuthorizedForInternal(HttpServletRequest request) {
+
         try {
+            if (Boolean.parseBoolean(isAddressAuthEnabled)) {
+                return true;
+            }
             InetAddress ip = InetAddress.getByName(request.getRemoteAddr());
             for (InetAddress node : getNodeAddresses()) {
-                if (node != null && ip.equals(node))
+                if (node != null && ip.equals(node)) {
                     return true;
+                }
             }
             for (InetAddress pod : getPodAddresses()) {
-                if (pod != null && ip.equals(pod))
+                if (pod != null && ip.equals(pod)) {
                     return true;
+                }
             }
-            if (thishost != null && ip.equals(thishost))
+            if (thishost != null && ip.equals(thishost)) {
                 return true;
-            if (loopback != null && ip.equals(loopback))
+            }
+            if (loopback != null && ip.equals(loopback)) {
                 return true;
+            }
             // Also allow the "special subnet" access
-            if (addressMatchesNetwork(ip, special_subnet_secondary))
+            if (addressMatchesNetwork(ip, researchSubnet1)) {
                 return true;
-            if (addressMatchesNetwork(ip, special_subnet))
+            }
+            if (addressMatchesNetwork(ip, researchSubnet)) {
                 return true;
+            }
         } catch (UnknownHostException e) {
             // ignore
         }
         return false;
     }
+
     /**
      * Check if an IP address matches a network address.
+     *
      * @param ip the IP address
      * @param s the network address; a bare IP address may be matched also
      * @return true if they intersect
      */
-    protected static boolean addressMatchesNetwork(InetAddress ip, String s) {
+    private static boolean addressMatchesNetwork(InetAddress ip, String s) {
         int mlen = -1;
         int n = s.indexOf("/");
         if (n >= 0) {
-            mlen = Integer.parseInt(s.substring(n+1));
+            mlen = Integer.parseInt(s.substring(n + 1));
             s = s.substring(0, n);
         }
         try {
             InetAddress i2 = InetAddress.getByName(s);
             byte[] b1 = ip.getAddress();
             byte[] b2 = i2.getAddress();
-            if (b1.length != b2.length)
+            if (b1.length != b2.length) {
                 return false;
+            }
             if (mlen > 0) {
                 byte[] masks = {
-                    (byte)0x00, (byte)0x80, (byte)0xC0, (byte)0xE0,
-                    (byte)0xF0, (byte)0xF8, (byte)0xFC, (byte)0xFE
+                    (byte) 0x00, (byte) 0x80, (byte) 0xC0, (byte) 0xE0,
+                    (byte) 0xF0, (byte) 0xF8, (byte) 0xFC, (byte) 0xFE
                 };
-                byte mask = masks[mlen%8];
-                for (n = mlen/8; n < b1.length; n++) {
+                byte mask = masks[mlen % 8];
+                for (n = mlen / 8; n < b1.length; n++) {
                     b1[n] &= mask;
                     b2[n] &= mask;
                     mask = 0;
                 }
             }
-            for (n = 0; n < b1.length; n++)
-                if (b1[n] != b2[n])
+            for (n = 0; n < b1.length; n++) {
+                if (b1[n] != b2[n]) {
                     return false;
+                }
+            }
         } catch (UnknownHostException e) {
             return false;
         }
         return true;
     }
+
     /**
-     * Something has changed in the provisioning data.
-     * Start the timers that will cause the pre-packaged JSON string to be regenerated,
-     * and cause nodes and the other provisioning server to be notified.
+     * Something has changed in the provisioning data. Start the timers that will cause the pre-packaged JSON string to
+     * be regenerated, and cause nodes and the other provisioning server to be notified.
      */
     public static void provisioningDataChanged() {
         long now = System.currentTimeMillis();
         Poker p = Poker.getPoker();
-        p.setTimers(now + (poke_timer1 * 1000L), now + (poke_timer2 * 1000L));
+        p.setTimers(now + (pokeTimer1 * 1000L), now + (pokeTimer2 * 1000L));
     }
+
     /**
      * Something in the parameters has changed, reload all parameters from the DB.
      */
     public static void provisioningParametersChanged() {
-        Map<String,String> map         = Parameters.getParameters();
-        require_secure   = getBoolean(map, Parameters.PROV_REQUIRE_SECURE);
-        require_cert     = getBoolean(map, Parameters.PROV_REQUIRE_CERT);
+        Map<String, String> map = Parameters.getParameters();
+        requireSecure = getBoolean(map, Parameters.PROV_REQUIRE_SECURE);
+        requireCert = getBoolean(map, Parameters.PROV_REQUIRE_CERT);
         authorizedAddressesAndNetworks = getSet(map, Parameters.PROV_AUTH_ADDRESSES);
-        authorizedNames  = getSet    (map, Parameters.PROV_AUTH_SUBJECTS);
-        nodes            = getSet    (map, Parameters.NODES).toArray(new String[0]);
-        max_feeds        = getInt    (map, Parameters.PROV_MAXFEED_COUNT, DEFAULT_MAX_FEEDS);
-        max_subs         = getInt    (map, Parameters.PROV_MAXSUB_COUNT, DEFAULT_MAX_SUBS);
-        poke_timer1      = getInt    (map, Parameters.PROV_POKETIMER1, DEFAULT_POKETIMER1);
-        poke_timer2      = getInt    (map, Parameters.PROV_POKETIMER2, DEFAULT_POKETIMER2);
-        prov_domain      = getString (map, Parameters.PROV_DOMAIN, DEFAULT_DOMAIN);
-        prov_name        = getString (map, Parameters.PROV_NAME, DEFAULT_PROVSRVR_NAME);
-        active_prov_name = getString (map, Parameters.PROV_ACTIVE_NAME, prov_name);
-        special_subnet   = getString (map, Parameters.PROV_SPECIAL_SUBNET, RESEARCH_SUBNET);
-        static_routing_nodes = getString (map, Parameters.STATIC_ROUTING_NODES, ""); //Adding new param for static Routing - Rally:US664862-1610
-        initial_active_pod  = getString (map, Parameters.ACTIVE_POD, "");
-        initial_standby_pod = getString (map, Parameters.STANDBY_POD, "");
-        static_routing_nodes = getString (map, Parameters.STATIC_ROUTING_NODES, ""); //Adding new param for static Routing - Rally:US664862-1610
-        active_feeds     = Feed.countActiveFeeds();
-        active_subs      = Subscription.countActiveSubscriptions();
+        authorizedNames = getSet(map, Parameters.PROV_AUTH_SUBJECTS);
+        nodes = getSet(map, Parameters.NODES).toArray(new String[0]);
+        maxFeeds = getInt(map, Parameters.PROV_MAXFEED_COUNT, DEFAULT_MAX_FEEDS);
+        maxSubs = getInt(map, Parameters.PROV_MAXSUB_COUNT, DEFAULT_MAX_SUBS);
+        pokeTimer1 = getInt(map, Parameters.PROV_POKETIMER1, DEFAULT_POKETIMER1);
+        pokeTimer2 = getInt(map, Parameters.PROV_POKETIMER2, DEFAULT_POKETIMER2);
+        provDomain = getString(map, Parameters.PROV_DOMAIN, DEFAULT_DOMAIN);
+        provName = getString(map, Parameters.PROV_NAME, DEFAULT_PROVSRVR_NAME);
+        activeProvName = getString(map, Parameters.PROV_ACTIVE_NAME, provName);
+        researchSubnet = getString(map, Parameters.PROV_SPECIAL_SUBNET, RESEARCH_SUBNET);
+        staticRoutingNodes = getString(map, Parameters.STATIC_ROUTING_NODES,
+            ""); //Adding new param for static Routing - Rally:US664862-1610
+        initialActivePod = getString(map, Parameters.ACTIVE_POD, "");
+        initialStandbyPod = getString(map, Parameters.STANDBY_POD, "");
+        staticRoutingNodes = getString(map, Parameters.STATIC_ROUTING_NODES,
+            ""); //Adding new param for static Routing - Rally:US664862-1610
+        activeFeeds = Feed.countActiveFeeds();
+        activeSubs = Subscription.countActiveSubscriptions();
         try {
-            this_pod = InetAddress.getLocalHost().getHostName();
+            thisPod = InetAddress.getLocalHost().getHostName();
         } catch (UnknownHostException e) {
-            this_pod = "";
+            thisPod = "";
             intlogger.warn("PROV0014 Cannot determine the name of this provisioning server.");
         }
 
         // Normalize the nodes, and fill in nodeAddresses
         InetAddress[] na = new InetAddress[nodes.length];
         for (int i = 0; i < nodes.length; i++) {
-            if (nodes[i].indexOf('.') < 0)
-                nodes[i] += "." + prov_domain;
+            if (nodes[i].indexOf('.') < 0) {
+                nodes[i] += "." + provDomain;
+            }
             try {
                 na[i] = InetAddress.getByName(nodes[i]);
-                intlogger.debug("PROV0003 DNS lookup: "+nodes[i]+" => "+na[i].toString());
+                intlogger.debug("PROV0003 DNS lookup: " + nodes[i] + " => " + na[i].toString());
             } catch (UnknownHostException e) {
                 na[i] = null;
-                intlogger.warn("PROV0004 Cannot lookup "+nodes[i]+": "+e);
+                intlogger.warn("PROV0004 Cannot lookup " + nodes[i] + ": " + e);
             }
         }
 
         //Reset Nodes arr after - removing static routing Nodes, Rally Userstory - US664862 .
         List<String> filterNodes = new ArrayList<>();
-        for (int i = 0; i < nodes.length; i++) {
-            if(!static_routing_nodes.contains(nodes[i])){
-                filterNodes.add(nodes[i]);
+        for (String node : nodes) {
+            if (!staticRoutingNodes.contains(node)) {
+                filterNodes.add(node);
             }
         }
-        String [] filteredNodes = filterNodes.toArray(new String[filterNodes.size()]);
-        nodes = filteredNodes;
+        nodes = filterNodes.toArray(new String[filterNodes.size()]);
 
         nodeAddresses = na;
         NodeClass.setNodes(nodes);        // update NODES table
@@ -429,14 +520,15 @@
         String[] pods = getPods();
         na = new InetAddress[pods.length];
         for (int i = 0; i < pods.length; i++) {
-            if (pods[i].indexOf('.') < 0)
-                pods[i] += "." + prov_domain;
+            if (pods[i].indexOf('.') < 0) {
+                pods[i] += "." + provDomain;
+            }
             try {
                 na[i] = InetAddress.getByName(pods[i]);
-                intlogger.debug("PROV0003 DNS lookup: "+pods[i]+" => "+na[i].toString());
+                intlogger.debug("PROV0003 DNS lookup: " + pods[i] + " => " + na[i].toString());
             } catch (UnknownHostException e) {
                 na[i] = null;
-                intlogger.warn("PROV0004 Cannot lookup "+pods[i]+": "+e);
+                intlogger.warn("PROV0004 Cannot lookup " + pods[i] + ": " + e);
             }
         }
         podAddresses = na;
@@ -445,16 +537,17 @@
         ThrottleFilter.configure();
 
         // Check if we are active or standby POD
-        if (!isInitialActivePOD() && !isInitialStandbyPOD())
+        if (!isInitialActivePOD() && !isInitialStandbyPOD()) {
             intlogger.warn("PROV0015 This machine is neither the active nor the standby POD.");
+        }
     }
 
 
-    /**Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047.
-     * Load mail properties.
-     * @author vs215k
+    /**
+     * Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047. Load mail properties.
      *
-    **/
+     * @author vs215k
+     **/
     private void loadMailProperties() {
         if (mailprops == null) {
             mailprops = new Properties();
@@ -462,46 +555,45 @@
             try {
                 mailprops.load(inStream);
             } catch (IOException e) {
-                intlogger.fatal("PROV9003 Opening properties: "+e.getMessage());
+                intlogger.fatal("PROV9003 Opening properties: " + e.getMessage());
                 e.printStackTrace();
                 System.exit(1);
-            }
-            finally {
+            } finally {
                 try {
                     inStream.close();
-                }
-                catch (IOException e) {
+                } catch (IOException e) {
                 }
             }
         }
     }
 
-    /**Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047.
-     * Check if HTTPS Relexaction is enabled
-     * @author vs215k
+    /**
+     * Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047. Check if HTTPS Relexaction is enabled
      *
-    **/
+     * @author vs215k
+     **/
     private void checkHttpsRelaxation() {
-        if(mailSendFlag == false) {
+        if (!mailSendFlag) {
             Properties p = (new DB()).getProperties();
-            intlogger.info("HTTPS relaxatio: "+p.get("org.onap.dmaap.datarouter.provserver.https.relaxation"));
+            intlogger.info("HTTPS relaxatio: " + p.get("org.onap.dmaap.datarouter.provserver.https.relaxation"));
 
-            if(p.get("org.onap.dmaap.datarouter.provserver.https.relaxation").equals("true")) {
+            if (p.get("org.onap.dmaap.datarouter.provserver.https.relaxation").equals("true")) {
                 try {
-                      notifyPSTeam(p.get("org.onap.dmaap.datarouter.provserver.https.relax.notify").toString());
-                }
-                catch (Exception e) {
+                    notifyPSTeam(p.get("org.onap.dmaap.datarouter.provserver.https.relax.notify").toString());
+                } catch (Exception e) {
                     e.printStackTrace();
                 }
-             }
+            }
             mailSendFlag = true;
         }
     }
 
-    /**Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047.
-     * @author vs215k
+    /**
+     * Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047.
+     *
      * @param email - list of email ids to notify if HTTP relexcation is enabled.
-    **/
+     * @author vs215k
+     **/
     private void notifyPSTeam(String email) throws Exception {
         loadMailProperties(); //Load HTTPS Relex mail properties.
         String[] emails = email.split(Pattern.quote("|"));
@@ -516,88 +608,101 @@
 
         try {
 
-          Message msg = new MimeMessage(session);
-          msg.setFrom(new InternetAddress(mailprops.get("com.att.dmaap.datarouter.mail.from").toString()));
+            Message msg = new MimeMessage(session);
+            msg.setFrom(new InternetAddress(mailprops.get("com.att.dmaap.datarouter.mail.from").toString()));
 
-          InternetAddress[] addressTo = new InternetAddress[emails.length];
-          for ( int x =0 ; x < emails.length; x++) {
-               addressTo[x] = new InternetAddress(emails[x]);
-          }
+            InternetAddress[] addressTo = new InternetAddress[emails.length];
+            for (int x = 0; x < emails.length; x++) {
+                addressTo[x] = new InternetAddress(emails[x]);
+            }
 
-          msg.addRecipients(Message.RecipientType.TO, addressTo);
-          msg.setSubject(mailprops.get("com.att.dmaap.datarouter.mail.subject").toString());
-          htmlPart.setContent(mailprops.get("com.att.dmaap.datarouter.mail.body").toString().replace("[SERVER]", InetAddress.getLocalHost().getHostName()), "text/html");
-          mp.addBodyPart(htmlPart);
-          msg.setContent(mp);
+            msg.addRecipients(Message.RecipientType.TO, addressTo);
+            msg.setSubject(mailprops.get("com.att.dmaap.datarouter.mail.subject").toString());
+            htmlPart.setContent(mailprops.get("com.att.dmaap.datarouter.mail.body").toString()
+                .replace("[SERVER]", InetAddress.getLocalHost().getHostName()), "text/html");
+            mp.addBodyPart(htmlPart);
+            msg.setContent(mp);
 
-          System.out.println(mailprops.get("com.att.dmaap.datarouter.mail.body").toString().replace("[SERVER]", InetAddress.getLocalHost().getHostName()));
+            System.out.println(mailprops.get("com.att.dmaap.datarouter.mail.body").toString()
+                .replace("[SERVER]", InetAddress.getLocalHost().getHostName()));
 
-          Transport.send(msg);
-          intlogger.info("HTTPS relaxation mail is sent to - : "+email);
+            Transport.send(msg);
+            intlogger.info("HTTPS relaxation mail is sent to - : " + email);
 
         } catch (AddressException 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);
         } 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);
         }
     }
 
 
     /**
      * Get an array of all node names in the DR network.
+     *
      * @return an array of Strings
      */
     public static String[] getNodes() {
         return nodes;
     }
+
     /**
      * Get an array of all node InetAddresses in the DR network.
+     *
      * @return an array of InetAddresses
      */
     public static InetAddress[] getNodeAddresses() {
         return nodeAddresses;
     }
+
     /**
      * Get an array of all POD names in the DR network.
+     *
      * @return an array of Strings
      */
     public static String[] getPods() {
-        return new String[] { initial_active_pod, initial_standby_pod };
+        return new String[]{initialActivePod, initialStandbyPod};
     }
+
     /**
      * Get an array of all POD InetAddresses in the DR network.
+     *
      * @return an array of InetAddresses
      */
-    public static InetAddress[] getPodAddresses() {
+    private static InetAddress[] getPodAddresses() {
         return podAddresses;
     }
+
     /**
-     * Gets the FQDN of the initially ACTIVE provisioning server (POD).
-     * Note: this used to be called isActivePOD(), however, that is a misnomer, as the active status
-     * could shift to the standby POD without these parameters changing.  Hence, the function names
-     * have been changed to more accurately reflect their purpose.
+     * Gets the FQDN of the initially ACTIVE provisioning server (POD). Note: this used to be called isActivePOD(),
+     * however, that is a misnomer, as the active status could shift to the standby POD without these parameters
+     * changing.  Hence, the function names have been changed to more accurately reflect their purpose.
+     *
      * @return the FQDN
      */
     public static boolean isInitialActivePOD() {
-        return this_pod.equals(initial_active_pod);
+        return thisPod.equals(initialActivePod);
     }
+
     /**
-     * Gets the FQDN of the initially STANDBY provisioning server (POD).
-     * Note: this used to be called isStandbyPOD(), however, that is a misnomer, as the standby status
-     * could shift to the active POD without these parameters changing.  Hence, the function names
-     * have been changed to more accurately reflect their purpose.
+     * Gets the FQDN of the initially STANDBY provisioning server (POD). Note: this used to be called isStandbyPOD(),
+     * however, that is a misnomer, as the standby status could shift to the active POD without these parameters
+     * changing.  Hence, the function names have been changed to more accurately reflect their purpose.
+     *
      * @return the FQDN
      */
     public static boolean isInitialStandbyPOD() {
-        return this_pod.equals(initial_standby_pod);
+        return thisPod.equals(initialStandbyPod);
     }
+
     /**
      * INSERT an {@link Insertable} bean into the database.
+     *
      * @param bean the bean representing a row to insert
      * @return true if the INSERT was successful
      */
     protected boolean doInsert(Insertable bean) {
-        boolean rv = false;
+        boolean rv;
         DB db = new DB();
         Connection conn = null;
         try {
@@ -605,21 +710,24 @@
             rv = bean.doInsert(conn);
         } catch (SQLException e) {
             rv = false;
-            intlogger.warn("PROV0005 doInsert: "+e.getMessage());
+            intlogger.warn("PROV0005 doInsert: " + e.getMessage());
             e.printStackTrace();
         } finally {
-            if (conn != null)
+            if (conn != null) {
                 db.release(conn);
+            }
         }
         return rv;
     }
+
     /**
      * UPDATE an {@link Updateable} bean in the database.
+     *
      * @param bean the bean representing a row to update
      * @return true if the UPDATE was successful
      */
     protected boolean doUpdate(Updateable bean) {
-        boolean rv = false;
+        boolean rv;
         DB db = new DB();
         Connection conn = null;
         try {
@@ -627,21 +735,24 @@
             rv = bean.doUpdate(conn);
         } catch (SQLException e) {
             rv = false;
-            intlogger.warn("PROV0006 doUpdate: "+e.getMessage());
+            intlogger.warn("PROV0006 doUpdate: " + e.getMessage());
             e.printStackTrace();
         } finally {
-            if (conn != null)
+            if (conn != null) {
                 db.release(conn);
+            }
         }
         return rv;
     }
+
     /**
      * DELETE an {@link Deleteable} bean from the database.
+     *
      * @param bean the bean representing a row to delete
      * @return true if the DELETE was successful
      */
     protected boolean doDelete(Deleteable bean) {
-        boolean rv = false;
+        boolean rv;
         DB db = new DB();
         Connection conn = null;
         try {
@@ -649,23 +760,27 @@
             rv = bean.doDelete(conn);
         } catch (SQLException e) {
             rv = false;
-            intlogger.warn("PROV0007 doDelete: "+e.getMessage());
+            intlogger.warn("PROV0007 doDelete: " + e.getMessage());
             e.printStackTrace();
         } finally {
-            if (conn != null)
+            if (conn != null) {
                 db.release(conn);
+            }
         }
         return rv;
     }
-    private static boolean getBoolean(Map<String,String> map, String name) {
+
+    private static boolean getBoolean(Map<String, String> map, String name) {
         String s = map.get(name);
         return (s != null) && s.equalsIgnoreCase("true");
     }
-    private static String getString(Map<String,String> map, String name, String dflt) {
+
+    private static String getString(Map<String, String> map, String name, String dflt) {
         String s = map.get(name);
         return (s != null) ? s : dflt;
     }
-    private static int getInt(Map<String,String> map, String name, int dflt) {
+
+    private static int getInt(Map<String, String> map, String name, int dflt) {
         try {
             String s = map.get(name);
             return Integer.parseInt(s);
@@ -673,7 +788,8 @@
             return dflt;
         }
     }
-    private static Set<String> getSet(Map<String,String> map, String name) {
+
+    private static Set<String> getSet(Map<String, String> map, String name) {
         Set<String> set = new HashSet<String>();
         String s = map.get(name);
         if (s != null) {
@@ -681,8 +797,9 @@
             if (pp != null) {
                 for (String t : pp) {
                     String t2 = t.trim();
-                    if (t2.length() > 0)
+                    if (t2.length() > 0) {
                         set.add(t2);
+                    }
                 }
             }
         }
@@ -690,36 +807,43 @@
     }
 
     /**
-     * A class used to encapsulate a Content-type header, separating out the "version" attribute
-     * (which defaults to "1.0" if missing).
+     * A class used to encapsulate a Content-type header, separating out the "version" attribute (which defaults to
+     * "1.0" if missing).
      */
     public class ContentHeader {
+
         private String type = "";
         private Map<String, String> map = new HashMap<String, String>();
-        public ContentHeader() {
+
+        ContentHeader() {
             this("", "1.0");
         }
-        public ContentHeader(String t, String v) {
+
+        ContentHeader(String t, String v) {
             type = t.trim();
             map.put("version", v);
         }
+
         public String getType() {
             return type;
         }
+
         public String getAttribute(String key) {
             String s = map.get(key);
-            if (s == null)
+            if (s == null) {
                 s = "";
+            }
             return s;
         }
     }
 
     /**
      * Get the ContentHeader from an HTTP request.
+     *
      * @param req the request
      * @return the header, encapsulated in a ContentHeader object
      */
-    public ContentHeader getContentHeader(HttpServletRequest req) {
+    ContentHeader getContentHeader(HttpServletRequest req) {
         ContentHeader ch = new ContentHeader();
         String s = req.getHeader("Content-Type");
         if (s != null) {
@@ -729,8 +853,8 @@
                 int ix = pp[i].indexOf('=');
                 if (ix > 0) {
                     String k = pp[i].substring(0, ix).trim();
-                    String v = pp[i].substring(ix+1).trim();
-                    ch.map.put(k,  v);
+                    String v = pp[i].substring(ix + 1).trim();
+                    ch.map.put(k, v);
                 } else {
                     ch.map.put(pp[i].trim(), "");
                 }
@@ -738,38 +862,44 @@
         }
         return ch;
     }
+
     // Methods for the Policy Engine classes - ProvDataProvider interface
     @Override
     public String getFeedOwner(String feedId) {
         try {
             int n = Integer.parseInt(feedId);
             Feed f = Feed.getFeedById(n);
-            if (f != null)
+            if (f != null) {
                 return f.getPublisher();
+            }
         } catch (NumberFormatException e) {
             // ignore
         }
         return null;
     }
+
     @Override
     public String getFeedClassification(String feedId) {
         try {
             int n = Integer.parseInt(feedId);
             Feed f = Feed.getFeedById(n);
-            if (f != null)
+            if (f != null) {
                 return f.getAuthorization().getClassification();
+            }
         } catch (NumberFormatException e) {
             // ignore
         }
         return null;
     }
+
     @Override
     public String getSubscriptionOwner(String subId) {
         try {
             int n = Integer.parseInt(subId);
             Subscription s = Subscription.getSubscriptionById(n);
-            if (s != null)
+            if (s != null) {
                 return s.getSubscriber();
+            }
         } catch (NumberFormatException e) {
             // ignore
         }
@@ -783,18 +913,19 @@
      */
     private boolean isUserMemberOfGroup(Group group, String user) {
 
-        String groupdetails = group.getMembers().replace("]", "").replace("[", "");
-        String s[] =    groupdetails.split("},");
+        String groupDetails = group.getMembers().replace("]", "").replace("[", "");
+        String[] s = groupDetails.split("},");
 
-        for(int i=0; i < s.length; i++) {
-                JSONObject jsonObj = null;
-                try {
-                    jsonObj = new JSONObject(s[i]+"}");
-                    if(jsonObj.get("id").equals(user))
-                        return true;
-                } catch (JSONException e) {
-                    e.printStackTrace();
+        for (String value : s) {
+            JSONObject jsonObj;
+            try {
+                jsonObj = new JSONObject(value + "}");
+                if (jsonObj.get("id").equals(user)) {
+                    return true;
                 }
+            } catch (JSONException e) {
+                e.printStackTrace();
+            }
         }
         return false;
 
@@ -812,9 +943,10 @@
             Feed f = Feed.getFeedById(n);
             if (f != null) {
                 int groupid = f.getGroupid();
-                if(groupid > 0) {
+                if (groupid > 0) {
                     Group group = Group.getGroupById(groupid);
-                    if(isUserMemberOfGroup(group, owner)) {
+                    assert group != null;
+                    if (isUserMemberOfGroup(group, owner)) {
                         return group.getAuthid();
                     }
                 }
@@ -837,9 +969,10 @@
             Subscription s = Subscription.getSubscriptionById(n);
             if (s != null) {
                 int groupid = s.getGroupid();
-                if(groupid > 0) {
+                if (groupid > 0) {
                     Group group = Group.getGroupById(groupid);
-                    if(isUserMemberOfGroup(group, owner)) {
+                    assert group != null;
+                    if (isUserMemberOfGroup(group, owner)) {
                         return group.getAuthid();
                     }
                 }
@@ -854,7 +987,7 @@
      * @Method - setIpAndFqdnForEelf - Rally:US664892
      * @Params - method, prints method name in EELF log.
      */
-    protected void setIpAndFqdnForEelf(String method) {
+    void setIpAndFqdnForEelf(String method) {
         MDC.clear();
         MDC.put(MDC_SERVICE_NAME, method);
         try {
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 dc9ec3a..47156d2 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
@@ -42,17 +42,18 @@
 import com.att.eelf.configuration.EELFManager;
 
 /**
- * This servlet handles provisioning for the &lt;drFeedsURL&gt; which is the URL on the
- * provisioning server used to create new feeds.  It supports POST to create new feeds,
- * and GET to support the Feeds Collection Query function.
+ * This servlet handles provisioning for the &lt;drFeedsURL&gt; which is the URL on the provisioning server used to
+ * create new feeds.  It supports POST to create new feeds, and GET to support the Feeds Collection Query function.
  *
  * @author Robert Eby
  * @version $Id$
  */
 @SuppressWarnings("serial")
 public class DRFeedsServlet extends ProxyServlet {
+
     //Adding EELF Logger Rally:US664892
-    private static EELFLogger eelflogger = EELFManager.getInstance().getLogger("org.onap.dmaap.datarouter.provisioning.DRFeedsServlet");
+    private static EELFLogger eelflogger = EELFManager.getInstance()
+        .getLogger("org.onap.dmaap.datarouter.provisioning.DRFeedsServlet");
 
     /**
      * DELETE on the &lt;drFeedsURL&gt; -- not supported.
@@ -60,7 +61,7 @@
     @Override
     public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         setIpAndFqdnForEelf("doDelete");
-        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
+        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
         String message = "DELETE not allowed for the drFeedsURL.";
         EventLogRecord elr = new EventLogRecord(req);
         elr.setMessage(message);
@@ -68,15 +69,15 @@
         eventlogger.info(elr);
         resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, message);
     }
+
     /**
-     * GET on the &lt;drFeedsURL&gt; -- query the list of feeds already existing in the DB.
-     * See the <i>Feeds Collection Queries</i> section in the <b>Provisioning API</b>
-     * document for details on how this method should be invoked.
+     * GET on the &lt;drFeedsURL&gt; -- query the list of feeds already existing in the DB. See the <i>Feeds Collection
+     * Queries</i> section in the <b>Provisioning API</b> document for details on how this method should be invoked.
      */
     @Override
     public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         setIpAndFqdnForEelf("doGet");
-        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
+        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
         EventLogRecord elr = new EventLogRecord(req);
         String message = isAuthorizedForProvisioning(req);
         if (message != null) {
@@ -92,14 +93,15 @@
         }
         String bhdr = req.getHeader(BEHALF_HEADER);
         if (bhdr == null) {
-            message = "Missing "+BEHALF_HEADER+" header.";
+            message = "Missing " + BEHALF_HEADER + " header.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
             eventlogger.info(elr);
             resp.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
             return;
         }
-        String path = req.getRequestURI(); // Note: I think this should be getPathInfo(), but that doesn't work (Jetty bug?)
+        String path = req
+            .getRequestURI(); // Note: I think this should be getPathInfo(), but that doesn't work (Jetty bug?)
         if (path != null && !path.equals("/")) {
             message = "Bad URL.";
             elr.setMessage(message);
@@ -110,7 +112,7 @@
         }
         // Check with the Authorizer
         AuthorizationResponse aresp = authz.decide(req);
-        if (! aresp.isAuthorized()) {
+        if (!aresp.isAuthorized()) {
             message = "Policy Engine disallows access.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_FORBIDDEN);
@@ -161,13 +163,14 @@
             resp.getOutputStream().print(t);
         }
     }
+
     /**
      * PUT on the &lt;drFeedsURL&gt; -- not supported.
      */
     @Override
     public void doPut(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         setIpAndFqdnForEelf("doPut");
-        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
+        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
         String message = "PUT not allowed for the drFeedsURL.";
         EventLogRecord elr = new EventLogRecord(req);
         elr.setMessage(message);
@@ -175,10 +178,10 @@
         eventlogger.info(elr);
         resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, message);
     }
+
     /**
-     * POST on the &lt;drFeedsURL&gt; -- create a new feed.
-     * See the <i>Creating a Feed</i> section in the <b>Provisioning API</b>
-     * document for details on how this method should be invoked.
+     * POST on the &lt;drFeedsURL&gt; -- create a new feed. See the <i>Creating a Feed</i> 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 {
@@ -199,14 +202,15 @@
         }
         String bhdr = req.getHeader(BEHALF_HEADER);
         if (bhdr == null) {
-            message = "Missing "+BEHALF_HEADER+" header.";
+            message = "Missing " + BEHALF_HEADER + " header.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
             eventlogger.info(elr);
             resp.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
             return;
         }
-        String path = req.getRequestURI(); // Note: I think this should be getPathInfo(), but that doesn't work (Jetty bug?)
+        String path = req
+            .getRequestURI(); // Note: I think this should be getPathInfo(), but that doesn't work (Jetty bug?)
         if (path != null && !path.equals("/")) {
             message = "Bad URL.";
             elr.setMessage(message);
@@ -228,7 +232,7 @@
         }
         // Check with the Authorizer
         AuthorizationResponse aresp = authz.decide(req);
-        if (! aresp.isAuthorized()) {
+        if (!aresp.isAuthorized()) {
             message = "Policy Engine disallows access.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_FORBIDDEN);
@@ -245,10 +249,11 @@
             resp.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
             return;
         }
-        if (intlogger.isDebugEnabled())
+        if (intlogger.isDebugEnabled()) {
             intlogger.debug(jo.toString());
-        if (++active_feeds > max_feeds) {
-            active_feeds--;
+        }
+        if (++activeFeeds > maxFeeds) {
+            activeFeeds--;
             message = "Cannot create feed; the maximum number of feeds has been configured.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_CONFLICT);
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedLogServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedLogServlet.java
index 7ac4bbe..2a1a842 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedLogServlet.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedLogServlet.java
@@ -24,14 +24,15 @@
 package org.onap.dmaap.datarouter.provisioning;
 
 /**
- * This servlet handles requests to the &lt;feedLogURL&gt;
- * which are generated by the provisioning server to handle the log query API.
+ * This servlet handles requests to the &lt;feedLogURL&gt; which are generated by the provisioning server to handle the
+ * log query API.
  *
  * @author Robert Eby
  * @version $Id: FeedLogServlet.java,v 1.1 2013/04/26 21:00:24 eby Exp $
  */
 @SuppressWarnings("serial")
 public class FeedLogServlet extends LogServlet {
+
     public FeedLogServlet() {
         super(true);
     }
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 d0f529c..3f8929e 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
@@ -116,7 +116,7 @@
         // Delete FEED table entry (set DELETED flag)
         feed.setDeleted(true);
         if (doUpdate(feed)) {
-            active_feeds--;
+            activeFeeds--;
             // send response
             elr.setResult(HttpServletResponse.SC_NO_CONTENT);
             eventlogger.info(elr);
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 2719208..61845ce 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
@@ -53,81 +53,86 @@
 
 /**
  * <p>
- * This servlet handles requests to URLs under /internal on the provisioning server.
- * These include:
+ * This servlet handles requests to URLs under /internal on the provisioning server. These include:
  * </p>
  * <div class="contentContainer">
  * <table class="packageSummary" border="0" cellpadding="3" cellspacing="0">
  * <caption><span>URL Path Summary</span><span class="tabEnd">&nbsp;</span></caption>
  * <tr>
- *   <th class="colFirst" width="15%">URL Path</th>
- *   <th class="colOne">Method</th>
- *   <th class="colLast">Purpose</th>
+ * <th class="colFirst" width="15%">URL Path</th>
+ * <th class="colOne">Method</th>
+ * <th class="colLast">Purpose</th>
  * </tr>
  * <tr class="altColor">
- *   <td class="colFirst">/internal/prov</td>
- *   <td class="colOne">GET</td>
- *   <td class="colLast">used to GET a full JSON copy of the provisioning data.</td>
+ * <td class="colFirst">/internal/prov</td>
+ * <td class="colOne">GET</td>
+ * <td class="colLast">used to GET a full JSON copy of the provisioning data.</td>
  * </tr>
  * <tr class="rowColor">
- *   <td class="colFirst">/internal/fetchProv</td>
- *   <td class="colOne">GET</td>
- *   <td class="colLast">used to signal to a standby POD that the provisioning data should be fetched from the active POD.</td>
+ * <td class="colFirst">/internal/fetchProv</td>
+ * <td class="colOne">GET</td>
+ * <td class="colLast">used to signal to a standby POD that the provisioning data should be fetched from the active
+ * POD.</td>
  * </tr>
  * <tr class="altColor">
- *   <td class="colFirst" rowspan="2">/internal/logs</td>
- *   <td class="colOne">GET</td>
- *   <td class="colLast">used to GET an index of log files and individual logs for this provisioning server.</td>
+ * <td class="colFirst" rowspan="2">/internal/logs</td>
+ * <td class="colOne">GET</td>
+ * <td class="colLast">used to GET an index of log files and individual logs for this provisioning server.</td>
  * </tr>
  * <tr class="altColor">
- *   <td class="colOne">POST</td>
- *   <td class="colLast">used to POST log files from the individual nodes to this provisioning server.</td>
+ * <td class="colOne">POST</td>
+ * <td class="colLast">used to POST log files from the individual nodes to this provisioning server.</td>
  * </tr>
  * <tr class="rowColor">
- *   <td class="colFirst" rowspan="4">/internal/api</td>
- *   <td class="colOne">GET</td>
- *   <td class="colLast">used to GET an individual parameter value. The parameter name is specified by the path after /api/.</td>
+ * <td class="colFirst" rowspan="4">/internal/api</td>
+ * <td class="colOne">GET</td>
+ * <td class="colLast">used to GET an individual parameter value. The parameter name is specified by the path after
+ * /api/.</td>
  * </tr>
  * <tr class="rowColor">
- *   <td class="colOne">PUT</td>
- *   <td class="colLast">used to set an individual parameter value. The parameter name is specified by the path after /api/.</td>
+ * <td class="colOne">PUT</td>
+ * <td class="colLast">used to set an individual parameter value. The parameter name is specified by the path after
+ * /api/.</td>
  * </tr>
  * <tr class="rowColor">
- *   <td class="colOne">DELETE</td>
- *   <td class="colLast">used to remove an individual parameter value. The parameter name is specified by the path after /api/.</td>
+ * <td class="colOne">DELETE</td>
+ * <td class="colLast">used to remove an individual parameter value. The parameter name is specified by the path after
+ * /api/.</td>
  * </tr>
  * <tr class="rowColor">
- *   <td class="colOne">POST</td>
- *   <td class="colLast">used to create a new individual parameter value. The parameter name is specified by the path after /api/.</td>
+ * <td class="colOne">POST</td>
+ * <td class="colLast">used to create a new individual parameter value. The parameter name is specified by the path
+ * after /api/.</td>
  * </tr>
  * <tr class="altColor">
- *   <td class="colFirst">/internal/halt</td>
- *   <td class="colOne">GET</td>
- *   <td class="colLast">used to halt the server (must be accessed from 127.0.0.1).</td>
+ * <td class="colFirst">/internal/halt</td>
+ * <td class="colOne">GET</td>
+ * <td class="colLast">used to halt the server (must be accessed from 127.0.0.1).</td>
  * </tr>
  * <tr class="rowColor">
- *   <td class="colFirst" rowspan="2">/internal/drlogs</td>
- *   <td class="colOne">GET</td>
- *   <td class="colLast">used to get a list of DR log entries available for retrieval.
- *   Note: these are the actual data router log entries sent to the provisioning server
- *   by the nodes, not the provisioning server's internal logs (access via /internal/logs above).
- *   The range is returned as a list of record sequence numbers.</td>
+ * <td class="colFirst" rowspan="2">/internal/drlogs</td>
+ * <td class="colOne">GET</td>
+ * <td class="colLast">used to get a list of DR log entries available for retrieval.
+ * Note: these are the actual data router log entries sent to the provisioning server by the nodes, not the provisioning
+ * server's internal logs (access via /internal/logs above). The range is returned as a list of record sequence
+ * numbers.</td>
  * </tr>
  * <tr class="rowColor">
- *   <td class="colOne">POST</td>
- *   <td class="colLast">used to retrieve specific log entries.
- *   The sequence numbers of the records to fetch are POST-ed; the records matching the sequence numbers are returned.</td>
+ * <td class="colOne">POST</td>
+ * <td class="colLast">used to retrieve specific log entries.
+ * The sequence numbers of the records to fetch are POST-ed; the records matching the sequence numbers are
+ * returned.</td>
  * </tr>
  * <tr class="altColor">
- *   <td class="colFirst">/internal/route/*</td>
- *   <td class="colOne">*</td>
- *   <td class="colLast">URLs under this path are handled via the {@link org.onap.dmaap.datarouter.provisioning.RouteServlet}</td>
+ * <td class="colFirst">/internal/route/*</td>
+ * <td class="colOne">*</td>
+ * <td class="colLast">URLs under this path are handled via the {@link org.onap.dmaap.datarouter.provisioning.RouteServlet}</td>
  * </tr>
  * </table>
  * </div>
  * <p>
- * Authorization to use these URLs is a little different than for other URLs on the provisioning server.
- * For the most part, the IP address that the request comes from should be either:
+ * Authorization to use these URLs is a little different than for other URLs on the provisioning server. For the most
+ * part, the IP address that the request comes from should be either:
  * </p>
  * <ol>
  * <li>an IP address of a provisioning server, or</li>
@@ -139,8 +144,8 @@
  * In addition, requests to /internal/halt can ONLY come from localhost (127.0.0.1) on the HTTP port.
  * </p>
  * <p>
- * All DELETE/GET/PUT/POST requests made to /internal/api on this servlet on the standby server are
- * proxied to the active server (using the {@link ProxyServlet}) if it is up and reachable.
+ * All DELETE/GET/PUT/POST requests made to /internal/api on this servlet on the standby server are proxied to the
+ * active server (using the {@link ProxyServlet}) if it is up and reachable.
  * </p>
  *
  * @author Robert Eby
@@ -148,18 +153,20 @@
  */
 @SuppressWarnings("serial")
 public class InternalServlet extends ProxyServlet {
-    private static Integer logseq = new Integer(0); // another piece of info to make log spool file names unique
+
+    private static Integer logseq = 0; // another piece of info to make log spool file names unique
     //Adding EELF Logger Rally:US664892
-    private static EELFLogger eelflogger = EELFManager.getInstance().getLogger("org.onap.dmaap.datarouter.provisioning.InternalServlet");
+    private static EELFLogger eelflogger = EELFManager.getInstance()
+        .getLogger("org.onap.dmaap.datarouter.provisioning.InternalServlet");
 
     /**
-     * Delete a parameter at the address /internal/api/&lt;parameter&gt;.
-     * See the <b>Internal API</b> document for details on how this method should be invoked.
+     * Delete a parameter at the address /internal/api/&lt;parameter&gt;. See the <b>Internal API</b> document for
+     * details on how this method should be invoked.
      */
     @Override
     public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         setIpAndFqdnForEelf("doDelete");
-        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
+        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
         EventLogRecord elr = new EventLogRecord(req);
         if (!isAuthorizedForInternal(req)) {
             elr.setMessage("Unauthorized.");
@@ -197,14 +204,15 @@
         }
         resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Bad URL.");
     }
+
     /**
-     * Get some information (such as a parameter) underneath the /internal/ namespace.
-     * See the <b>Internal API</b> document for details on how this method should be invoked.
+     * Get some information (such as a parameter) underneath the /internal/ namespace. See the <b>Internal API</b>
+     * document for details on how this method should be invoked.
      */
     @Override
     public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         setIpAndFqdnForEelf("doGet");
-        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
+        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
         String path = req.getPathInfo();
         if (path.equals("/halt") && !req.isSecure()) {
             // request to halt the server - can ONLY come from localhost
@@ -214,7 +222,7 @@
                 resp.setStatus(HttpServletResponse.SC_OK);
                 Main.shutdown();
             } else {
-                intlogger.info("PROV0010 Disallowed request to HALT received from "+remote);
+                intlogger.info("PROV0010 Disallowed request to HALT received from " + remote);
                 resp.setStatus(HttpServletResponse.SC_FORBIDDEN);
             }
             return;
@@ -237,8 +245,9 @@
         }
         if (path.equals("/prov")) {
             if (isProxyOK(req) && isProxyServer()) {
-                if (super.doGetWithFallback(req, resp))
+                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.");
             }
@@ -297,14 +306,15 @@
         }
         resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Bad URL.");
     }
+
     /**
-     * Modify a parameter at the address /internal/api/&lt;parameter&gt;.
-     * See the <b>Internal API</b> document for details on how this method should be invoked.
+     * Modify a parameter at the address /internal/api/&lt;parameter&gt;. See the <b>Internal API</b> document for
+     * details on how this method should be invoked.
      */
     @Override
     public void doPut(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         setIpAndFqdnForEelf("doPut");
-        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
+        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
         EventLogRecord elr = new EventLogRecord(req);
         if (!isAuthorizedForInternal(req)) {
             elr.setMessage("Unauthorized.");
@@ -343,9 +353,10 @@
         }
         resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Bad URL.");
     }
+
     /**
-     * Create some new information (such as a parameter or log entries) underneath the /internal/ namespace.
-     * See the <b>Internal API</b> document for details on how this method should be invoked.
+     * Create some new information (such as a parameter or log entries) underneath the /internal/ namespace. See the
+     * <b>Internal API</b> document for details on how this method should be invoked.
      */
     @SuppressWarnings("resource")
     @Override
@@ -394,7 +405,7 @@
             String ctype = req.getHeader("Content-Type");
             if (ctype == null || !ctype.equals("text/plain")) {
                 elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
-                elr.setMessage("Bad media type: "+ctype);
+                elr.setMessage("Bad media type: " + ctype);
                 resp.setStatus(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
                 eventlogger.info(elr);
                 return;
@@ -421,11 +432,14 @@
             FileSystem fs = (Paths.get(spooldir)).getFileSystem();
             long total = 0;
             long avail = 0;
-            for (FileStore store: fs.getFileStores()) {
+            for (FileStore store : fs.getFileStores()) {
                 total += store.getTotalSpace();
                 avail += store.getUsableSpace();
             }
-            try { fs.close(); } catch (Exception e) { }
+            try {
+                fs.close();
+            } catch (Exception e) {
+            }
             if (((avail * 100) / total) < 5) {
                 elr.setResult(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
                 resp.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
@@ -433,7 +447,7 @@
                 return;
             }
             Path tmppath = Paths.get(spooldir, spoolname);
-            Path donepath = Paths.get(spooldir, "IN."+spoolname);
+            Path donepath = Paths.get(spooldir, "IN." + spoolname);
             Files.copy(req.getInputStream(), Paths.get(spooldir, spoolname), StandardCopyOption.REPLACE_EXISTING);
             Files.move(tmppath, donepath, StandardCopyOption.REPLACE_EXISTING);
             elr.setResult(HttpServletResponse.SC_CREATED);
@@ -448,7 +462,7 @@
             String ctype = req.getHeader("Content-Type");
             if (ctype == null || !ctype.equals("text/plain")) {
                 elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
-                elr.setMessage("Bad media type: "+ctype);
+                elr.setMessage("Bad media type: " + ctype);
                 resp.setStatus(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
                 eventlogger.info(elr);
                 return;
@@ -456,8 +470,9 @@
             InputStream is = req.getInputStream();
             ByteArrayOutputStream bos = new ByteArrayOutputStream();
             int ch = 0;
-            while ((ch = is.read()) >= 0)
+            while ((ch = is.read()) >= 0) {
                 bos.write(ch);
+            }
             RLEBitSet bs = new RLEBitSet(bos.toString());    // The set of records to retrieve
             elr.setResult(HttpServletResponse.SC_OK);
             resp.setStatus(HttpServletResponse.SC_OK);
@@ -484,6 +499,7 @@
         }
         return sb.toString();
     }
+
     private JSONArray generateLogfileList() {
         JSONArray ja = new JSONArray();
         Properties p = (new DB()).getProperties();
@@ -495,8 +511,9 @@
                 String[] list = f.list();
                 if (list != null) {
                     for (String s2 : list) {
-                        if (!s2.startsWith("."))
+                        if (!s2.startsWith(".")) {
                             ja.put(s2);
+                        }
                     }
                 }
             }
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 3e3f45f..3afce99 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
@@ -55,14 +55,14 @@
 
 /**
  * <p>
- * A main class which may be used to start the provisioning server with an "embedded" Jetty server.
- * Configuration is done via the properties file <i>provserver.properties</i>, which should be in the CLASSPATH.
- * The provisioning server may also be packaged with a web.xml and started as a traditional webapp.
+ * A main class which may be used to start the provisioning server with an "embedded" Jetty server. Configuration is
+ * done via the properties file <i>provserver.properties</i>, which should be in the CLASSPATH. The provisioning server
+ * may also be packaged with a web.xml and started as a traditional webapp.
  * </p>
  * <p>
- * Most of the work of the provisioning server is carried out within the eight servlets (configured below)
- * that are used to handle each of the eight types of requests the server may receive.
- * In addition, there are background threads started to perform other tasks:
+ * Most of the work of the provisioning server is carried out within the eight servlets (configured below) that are used
+ * to handle each of the eight types of requests the server may receive. In addition, there are background threads
+ * started to perform other tasks:
  * </p>
  * <ul>
  * <li>One background Thread runs the {@link LogfileLoader} in order to process incoming logfiles.
@@ -75,14 +75,15 @@
  * /opt/app/datartr/logs directory.</li>
  * </ul>
  * <p>
- * The provisioning server is stopped by issuing a GET to the URL http://127.0.0.1/internal/halt
- * using <i>curl</i> or some other such tool.
+ * The provisioning server is stopped by issuing a GET to the URL http://127.0.0.1/internal/halt using <i>curl</i> or
+ * some other such tool.
  * </p>
  *
  * @author Robert Eby
  * @version $Id: Main.java,v 1.12 2014/03/12 19:45:41 eby Exp $
  */
 public class Main {
+
     /**
      * The truststore to use if none is specified
      */
@@ -109,8 +110,9 @@
         Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
 
         // Check DB is accessible and contains the expected tables
-        if (!checkDatabase(logger))
+        if (!checkDatabase(logger)) {
             System.exit(1);
+        }
 
         logger.info("PROV0000 **** AT&T Data Router Provisioning Server starting....");
 
@@ -139,101 +141,109 @@
         server = new Server(queuedThreadPool);
 
         // HTTP connector
-        ServerConnector httpServerConnector = new ServerConnector(server, new HttpConnectionFactory(httpConfiguration));
-        httpServerConnector.setPort(httpPort);
-        httpServerConnector.setAcceptQueueSize(2);
+        HandlerCollection hc;
+        try (ServerConnector httpServerConnector = new ServerConnector(server,
+            new HttpConnectionFactory(httpConfiguration))) {
+            httpServerConnector.setPort(httpPort);
+            httpServerConnector.setAcceptQueueSize(2);
 
-        // HTTPS configuration
-        HttpConfiguration httpsConfiguration = new HttpConfiguration(httpConfiguration);
-        httpsConfiguration.setRequestHeaderSize(8192);
+            // HTTPS configuration
+            HttpConfiguration httpsConfiguration = new HttpConfiguration(httpConfiguration);
+            httpsConfiguration.setRequestHeaderSize(8192);
 
-        // HTTPS connector
-        SslContextFactory sslContextFactory = new SslContextFactory();
-        sslContextFactory.setKeyStorePath(p.getProperty(KEYSTORE_PATH_PROPERTY));
-        sslContextFactory.setKeyStorePassword(p.getProperty(KEYSTORE_PASSWORD_PROPERTY));
-        sslContextFactory.setKeyManagerPassword(p.getProperty("org.onap.dmaap.datarouter.provserver.keymanager.password"));
-        // SSL stuff
-        /* Skip SSLv3 Fixes */
-        sslContextFactory.addExcludeProtocols("SSLv3");
-        logger.info("Excluded protocols prov-" + sslContextFactory.getExcludeProtocols());
-        /* End of SSLv3 Fixes */
+            // HTTPS connector
+            SslContextFactory sslContextFactory = new SslContextFactory();
+            sslContextFactory.setKeyStorePath(p.getProperty(KEYSTORE_PATH_PROPERTY));
+            sslContextFactory.setKeyStorePassword(p.getProperty(KEYSTORE_PASSWORD_PROPERTY));
+            sslContextFactory
+                .setKeyManagerPassword(p.getProperty("org.onap.dmaap.datarouter.provserver.keymanager.password"));
+            // SSL stuff
+            /* Skip SSLv3 Fixes */
+            sslContextFactory.addExcludeProtocols("SSLv3");
+            logger.info("Excluded protocols prov-" + Arrays.toString(sslContextFactory.getExcludeProtocols()));
+            /* End of SSLv3 Fixes */
 
-        ServerConnector httpsServerConnector = new ServerConnector(server,
-                new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
+            ServerConnector httpsServerConnector = new ServerConnector(server,
+                new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
                 new HttpConnectionFactory(httpsConfiguration));
-        httpsServerConnector.setPort(httpsPort);
-        httpsServerConnector.setIdleTimeout(30000);
-        httpsServerConnector.setAcceptQueueSize(2);
+            httpsServerConnector.setPort(httpsPort);
+            httpsServerConnector.setIdleTimeout(30000);
+            httpsServerConnector.setAcceptQueueSize(2);
 
-        sslContextFactory.setKeyStoreType(p.getProperty(KEYSTORE_TYPE_PROPERTY, "jks"));
-        sslContextFactory.setKeyStorePath(p.getProperty(KEYSTORE_PATH_PROPERTY));
-        sslContextFactory.setKeyStorePassword(p.getProperty(KEYSTORE_PASSWORD_PROPERTY));
-        sslContextFactory.setKeyManagerPassword(p.getProperty("org.onap.dmaap.datarouter.provserver.keymanager.password"));
+            sslContextFactory.setKeyStoreType(p.getProperty(KEYSTORE_TYPE_PROPERTY, "jks"));
+            sslContextFactory.setKeyStorePath(p.getProperty(KEYSTORE_PATH_PROPERTY));
+            sslContextFactory.setKeyStorePassword(p.getProperty(KEYSTORE_PASSWORD_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);
-            sslContextFactory.setTrustStorePath(ts);
-            sslContextFactory.setTrustStorePassword(p.getProperty(TRUSTSTORE_PASSWORD_PROPERTY));
-        } else {
-            sslContextFactory.setTrustStorePath(DEFAULT_TRUSTSTORE);
+            String ts = p.getProperty(TRUSTSTORE_PATH_PROPERTY);
+            if (ts != null && ts.length() > 0) {
+                System.out.println("@@ TS -> " + ts);
+                sslContextFactory.setTrustStorePath(ts);
+                sslContextFactory.setTrustStorePassword(p.getProperty(TRUSTSTORE_PASSWORD_PROPERTY));
+            } else {
+                sslContextFactory.setTrustStorePath(DEFAULT_TRUSTSTORE);
+                sslContextFactory.setTrustStorePassword("changeit");
+            }
+            sslContextFactory.setTrustStorePath("/opt/app/datartr/self_signed/cacerts.jks");
             sslContextFactory.setTrustStorePassword("changeit");
+            sslContextFactory.setWantClientAuth(true);
+
+            // Servlet and Filter configuration
+            ServletContextHandler ctxt = new ServletContextHandler(0);
+            ctxt.setContextPath("/");
+            ctxt.addServlet(new ServletHolder(new FeedServlet()), "/feed/*");
+            ctxt.addServlet(new ServletHolder(new FeedLogServlet()), "/feedlog/*");
+            ctxt.addServlet(new ServletHolder(new PublishServlet()), "/publish/*");
+            ctxt.addServlet(new ServletHolder(new SubscribeServlet()), "/subscribe/*");
+            ctxt.addServlet(new ServletHolder(new StatisticsServlet()), "/statistics/*");
+            ctxt.addServlet(new ServletHolder(new SubLogServlet()), "/sublog/*");
+            ctxt.addServlet(new ServletHolder(new GroupServlet()),
+                "/group/*"); //Provision groups - Rally US708115 -1610
+            ctxt.addServlet(new ServletHolder(new SubscriptionServlet()), "/subs/*");
+            ctxt.addServlet(new ServletHolder(new InternalServlet()), "/internal/*");
+            ctxt.addServlet(new ServletHolder(new RouteServlet()), "/internal/route/*");
+            ctxt.addServlet(new ServletHolder(new DRFeedsServlet()), "/");
+            ctxt.addFilter(new FilterHolder(new ThrottleFilter()), "/publish/*", EnumSet.of(DispatcherType.REQUEST));
+
+            ContextHandlerCollection contexts = new ContextHandlerCollection();
+            contexts.addHandler(ctxt);
+
+            // Request log configuration
+            NCSARequestLog nrl = new NCSARequestLog();
+            nrl.setFilename(
+                p.getProperty("org.onap.dmaap.datarouter.provserver.accesslog.dir") + "/request.log.yyyy_mm_dd");
+            nrl.setFilenameDateFormat("yyyyMMdd");
+            nrl.setRetainDays(90);
+            nrl.setAppend(true);
+            nrl.setExtended(false);
+            nrl.setLogCookies(false);
+            nrl.setLogTimeZone("GMT");
+
+            RequestLogHandler reqlog = new RequestLogHandler();
+            reqlog.setRequestLog(nrl);
+
+            // Server's Handler collection
+            hc = new HandlerCollection();
+            hc.setHandlers(new Handler[]{contexts, new DefaultHandler()});
+            hc.addHandler(reqlog);
+
+            // Daemon to clean up the log directory on a daily basis
+            Timer rolex = new Timer();
+            rolex.scheduleAtFixedRate(new PurgeLogDirTask(), 0, 86400000L);    // run once per day
+
+            // Start LogfileLoader
+            LogfileLoader.getLoader();
+
+            try (ServerConnector serverConnector = new ServerConnector(server,
+                new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
+                new HttpConnectionFactory(httpsConfiguration))) {
+                serverConnector.setPort(httpsPort);
+                serverConnector.setIdleTimeout(500000);
+            }
+
+            server.setConnectors(new Connector[]{httpServerConnector, httpsServerConnector});
         }
-        sslContextFactory.setTrustStorePath("/opt/app/datartr/self_signed/cacerts.jks");
-        sslContextFactory.setTrustStorePassword("changeit");
-        sslContextFactory.setWantClientAuth(true);
-
-        // Servlet and Filter configuration
-        ServletContextHandler ctxt = new ServletContextHandler(0);
-        ctxt.setContextPath("/");
-        ctxt.addServlet(new ServletHolder(new FeedServlet()), "/feed/*");
-        ctxt.addServlet(new ServletHolder(new FeedLogServlet()), "/feedlog/*");
-        ctxt.addServlet(new ServletHolder(new PublishServlet()), "/publish/*");
-        ctxt.addServlet(new ServletHolder(new SubscribeServlet()), "/subscribe/*");
-        ctxt.addServlet(new ServletHolder(new StatisticsServlet()), "/statistics/*");
-        ctxt.addServlet(new ServletHolder(new SubLogServlet()), "/sublog/*");
-        ctxt.addServlet(new ServletHolder(new GroupServlet()), "/group/*"); //Provision groups - Rally US708115 -1610
-        ctxt.addServlet(new ServletHolder(new SubscriptionServlet()), "/subs/*");
-        ctxt.addServlet(new ServletHolder(new InternalServlet()), "/internal/*");
-        ctxt.addServlet(new ServletHolder(new RouteServlet()), "/internal/route/*");
-        ctxt.addServlet(new ServletHolder(new DRFeedsServlet()), "/");
-        ctxt.addFilter(new FilterHolder(new ThrottleFilter()), "/publish/*", EnumSet.of(DispatcherType.REQUEST));
-
-        ContextHandlerCollection contexts = new ContextHandlerCollection();
-        contexts.addHandler(ctxt);
-
-        // Request log configuration
-        NCSARequestLog nrl = new NCSARequestLog();
-        nrl.setFilename(p.getProperty("org.onap.dmaap.datarouter.provserver.accesslog.dir") + "/request.log.yyyy_mm_dd");
-        nrl.setFilenameDateFormat("yyyyMMdd");
-        nrl.setRetainDays(90);
-        nrl.setAppend(true);
-        nrl.setExtended(false);
-        nrl.setLogCookies(false);
-        nrl.setLogTimeZone("GMT");
-
-        RequestLogHandler reqlog = new RequestLogHandler();
-        reqlog.setRequestLog(nrl);
-
-        // Server's Handler collection
-        HandlerCollection hc = new HandlerCollection();
-        hc.setHandlers(new Handler[]{contexts, new DefaultHandler()});
-        hc.addHandler(reqlog);
-
-        // Daemon to clean up the log directory on a daily basis
-        Timer rolex = new Timer();
-        rolex.scheduleAtFixedRate(new PurgeLogDirTask(), 0, 86400000L);    // run once per day
-
-        // Start LogfileLoader
-        LogfileLoader.getLoader();
-
-        ServerConnector serverConnector = new ServerConnector(server,
-                new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
-                new HttpConnectionFactory(httpsConfiguration));
-        serverConnector.setPort(httpsPort);
-        serverConnector.setIdleTimeout(500000);
-
-        server.setConnectors(new Connector[]{httpServerConnector, httpsServerConnector});
         server.setHandler(hc);
         server.setStopAtShutdown(true);
         server.setStopTimeout(5000);
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 4250624..f2c511c 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
@@ -23,9 +23,7 @@
 
 package org.onap.dmaap.datarouter.provisioning;
 
-import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.HttpURLConnection;
 import java.net.InetAddress;
 import java.net.MalformedURLException;
@@ -34,14 +32,11 @@
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Set;
 import java.util.Timer;
 import java.util.TimerTask;
 import java.util.TreeSet;
 
-import javax.servlet.ServletException;
-
 import org.apache.log4j.Logger;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -56,84 +51,92 @@
 import org.onap.dmaap.datarouter.provisioning.utils.*;
 
 /**
- * This class handles the two timers (described in R1 Design Notes), and takes care of issuing
- * the GET to each node of the URL to "poke".
+ * This class handles the two timers (described in R1 Design Notes), and takes care of issuing the GET to each node of
+ * the URL to "poke".
  *
  * @author Robert Eby
  * @version $Id: Poker.java,v 1.11 2014/01/08 16:13:47 eby Exp $
  */
 public class Poker extends TimerTask {
-    /** Template used to generate the URL to issue the GET against */
-    public static final String POKE_URL_TEMPLATE = "http://%s/internal/fetchProv";
 
+    /**
+     * Template used to generate the URL to issue the GET against
+     */
+    private static final String POKE_URL_TEMPLATE = "http://%s/internal/fetchProv";
 
-
-
-    /** This is a singleton -- there is only one Poker object in the server */
-    private static Poker p;
+    /**
+     * This is a singleton -- there is only one Poker object in the server
+     */
+    private static Poker poker;
 
     /**
      * Get the singleton Poker object.
+     *
      * @return the Poker
      */
     public static synchronized Poker getPoker() {
-        if (p == null)
-            p = new Poker();
-        return p;
+        if (poker == null) {
+            poker = new Poker();
+        }
+        return poker;
     }
 
     private long timer1;
     private long timer2;
-    private Timer rolex;
-    private String this_pod;        // DNS name of this machine
+    private String thisPod;        // DNS name of this machine
     private Logger logger;
-    private String provstring;
+    private String provString;
 
     private Poker() {
         timer1 = timer2 = 0;
-        rolex = new Timer();
+        Timer rolex = new Timer();
         logger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
         try {
-            this_pod = InetAddress.getLocalHost().getHostName();
+            thisPod = InetAddress.getLocalHost().getHostName();
         } catch (UnknownHostException e) {
-            this_pod = "*UNKNOWN*";    // not a major problem
+            thisPod = "*UNKNOWN*";    // not a major problem
         }
-        provstring = buildProvisioningString();
+        provString = buildProvisioningString();
 
         rolex.scheduleAtFixedRate(this, 0L, 1000L);    // Run once a second to check the timers
     }
 
     /**
      * This method sets the two timers described in the design notes.
-     * @param t1 the first timer controls how long to wait after a provisioning request before poking each node
-     *   This timer can be reset if it has not "gone off".
+     *
+     * @param t1 the first timer controls how long to wait after a provisioning request before poking each node This
+     * timer can be reset if it has not "gone off".
      * @param t2 the second timer set the outer bound on how long to wait.  It cannot be reset.
      */
     public void setTimers(long t1, long t2) {
-        synchronized (this_pod) {
-            if (timer1 == 0 || t1 > timer1)
+        synchronized (thisPod) {
+            if (timer1 == 0 || t1 > timer1) {
                 timer1 = t1;
-            if (timer2 == 0)
+            }
+            if (timer2 == 0) {
                 timer2 = t2;
+            }
         }
-        if (logger.isDebugEnabled())
+        if (logger.isDebugEnabled()) {
             logger.debug("Poker timers set to " + timer1 + " and " + timer2);
+        }
 
 
     }
 
     /**
      * Return the last provisioning string built.
+     *
      * @return the last provisioning string built.
      */
     public String getProvisioningString() {
-        return provstring;
+        return provString;
     }
 
     /**
-     * The method to run at the predefined interval (once per second).  This method checks
-     * to see if either of the two timers has expired, and if so, will rebuild the provisioning
-     * string, and poke all the nodes and other PODs.  The timers are then reset to 0.
+     * The method to run at the predefined interval (once per second).  This method checks to see if either of the two
+     * timers has expired, and if so, will rebuild the provisioning string, and poke all the nodes and other PODs.  The
+     * timers are then reset to 0.
      */
     @Override
     public void run() {
@@ -141,62 +144,61 @@
             if (timer1 > 0) {
                 long now = System.currentTimeMillis();
                 boolean fire = false;
-                synchronized (this_pod) {
+                synchronized (thisPod) {
                     if (now > timer1 || now > timer2) {
                         timer1 = timer2 = 0;
                         fire = true;
                     }
                 }
                 if (fire) {
-                    // Rebuild the prov string
-                    provstring = buildProvisioningString();
-
-                    // Only the active POD should poke nodes, etc.
-                    boolean active = SynchronizerTask.getSynchronizer().isActive();
-                    if (active) {
-                        // Poke all the DR nodes
-                        for (String n : BaseServlet.getNodes()) {
-                            pokeNode(n);
-                        }
-                        // Poke the pod that is not us
-                        for (String n : BaseServlet.getPods()) {
-                            if (n.length() > 0 && !n.equals(this_pod))
-                                pokeNode(n);
-                        }
-                    }
+                    pokeNodes();
                 }
             }
         } catch (Exception e) {
-            logger.warn("PROV0020: Caught exception in Poker: "+e);
+            logger.warn("PROV0020: Caught exception in Poker: " + e);
             e.printStackTrace();
         }
     }
-    private void pokeNode(final String nodename) {
-        logger.debug("PROV0012 Poking node " + nodename + " ...");
-        Runnable r = new Runnable() {
-            @Override
-            public void run() {
 
-                try {
-                    String u = String.format(POKE_URL_TEMPLATE, nodename+":"+DB.HTTP_PORT);
-                    URL url = new URL(u);
-                    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-                    conn.setConnectTimeout(60000);    //Fixes for Itrack DATARTR-3, poke timeout
-                    conn.connect();
-                    conn.getContentLength();    // Force the GET through
-                    conn.disconnect();
-                } catch (MalformedURLException e) {
-                    logger.warn("PROV0013 MalformedURLException Error poking node "+nodename+": " + e.getMessage());
-                } catch (IOException e) {
-                    logger.warn("PROV0013 IOException Error poking node "+nodename+": " + e.getMessage());
+    private void pokeNodes() {
+        // Rebuild the prov string
+        provString = buildProvisioningString();
+        // Only the active POD should poke nodes, etc.
+        boolean active = SynchronizerTask.getSynchronizer().isActive();
+        if (active) {
+            // Poke all the DR nodes
+            for (String n : BaseServlet.getNodes()) {
+                pokeNode(n);
+            }
+            // Poke the pod that is not us
+            for (String n : BaseServlet.getPods()) {
+                if (n.length() > 0 && !n.equals(thisPod)) {
+                    pokeNode(n);
                 }
             }
+        }
+    }
+
+    private void pokeNode(final String nodename) {
+        logger.debug("PROV0012 Poking node " + nodename + " ...");
+        String nodeUrl = String.format(POKE_URL_TEMPLATE, nodename + ":" + DB.HTTP_PORT);
+        Runnable r = () -> {
+            try {
+                URL url = new URL(nodeUrl);
+                HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+                conn.setConnectTimeout(60000);    //Fixes for Itrack DATARTR-3, poke timeout
+                conn.connect();
+                conn.getContentLength();    // Force the GET through
+                conn.disconnect();
+            } catch (MalformedURLException e) {
+                logger.warn("PROV0013 MalformedURLException Error poking node at " + nodeUrl + " : " + e.getMessage());
+            } catch (IOException e) {
+                logger.warn("PROV0013 IOException Error poking node at " + nodeUrl + " : " + e.getMessage());
+            }
         };
-//        Thread t = new Thread(r);
-//        t.start();
         r.run();
     }
-    @SuppressWarnings("unused")
+
     private String buildProvisioningString() {
         StringBuilder sb = new StringBuilder("{\n");
 
@@ -220,14 +222,14 @@
         }
         sb.append("\n],\n");
 
-
         // Append Subscriptions to the string
         pfx = "\n";
         sb.append("\"subscriptions\": [");
         for (Subscription s : Subscription.getAllSubscriptions()) {
             sb.append(pfx);
-            if(s!=null)
-            sb.append(s.asJSONObject().toString());
+            if (s != null) {
+                sb.append(s.asJSONObject().toString());
+            }
             pfx = ",\n";
         }
         sb.append("\n],\n");
@@ -235,11 +237,12 @@
         // Append Parameters to the string
         pfx = "\n";
         sb.append("\"parameters\": {");
-        Map<String,String> props = Parameters.getParameters();
+        Map<String, String> props = Parameters.getParameters();
         Set<String> ivals = new HashSet<String>();
         String intv = props.get("_INT_VALUES");
-        if (intv != null)
+        if (intv != null) {
             ivals.addAll(Arrays.asList(intv.split("\\|")));
+        }
         for (String key : new TreeSet<String>(props.keySet())) {
             String v = props.get(key);
             sb.append(pfx);
@@ -279,7 +282,7 @@
         for (EgressRoute eg : EgressRoute.getAllEgressRoutes()) {
             sb.append(pfx);
             String t = eg.asJSONObject().toString();
-            t = t.substring(1, t.length()-1);
+            t = t.substring(1, t.length() - 1);
             sb.append(t);
             pfx = ",\n";
         }
@@ -296,14 +299,15 @@
         sb.append("\n}");
 
         // Convert to string and verify it is valid JSON
-        String provstring = sb.toString();
+        String tempProvString = sb.toString();
         try {
-            new JSONObject(new JSONTokener(provstring));
+            new JSONObject(new JSONTokener(tempProvString));
         } catch (JSONException e) {
-            logger.warn("PROV0016: Possible invalid prov string: "+e);
+            logger.warn("PROV0016: Possible invalid prov string: " + e);
         }
-        return provstring;
+        return tempProvString;
     }
+
     private String quote(String s) {
         StringBuilder sb = new StringBuilder();
         for (char ch : s.toCharArray()) {
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 3ad2242..21d391e 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
@@ -43,8 +43,8 @@
 import com.att.eelf.configuration.EELFManager;
 
 /**
- * This servlet handles provisioning for the &lt;subscribeURL&gt; which is generated by the provisioning
- * server to handle the creation and inspection of subscriptions to a specific feed.
+ * This servlet handles provisioning for the &lt;subscribeURL&gt; which is generated by the provisioning server to
+ * handle the creation and inspection of subscriptions to a specific feed.
  *
  * @author Robert Eby
  * @version $Id$
@@ -53,7 +53,8 @@
 public class SubscribeServlet extends ProxyServlet {
 
     //Adding EELF Logger Rally:US664892
-    private static EELFLogger eelflogger = EELFManager.getInstance().getLogger("org.onap.dmaap.datarouter.provisioning.SubscribeServlet");
+    private static EELFLogger eelflogger = EELFManager.getInstance()
+        .getLogger("org.onap.dmaap.datarouter.provisioning.SubscribeServlet");
 
     /**
      * DELETE on the &lt;subscribeUrl&gt; -- not supported.
@@ -61,7 +62,7 @@
     @Override
     public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         setIpAndFqdnForEelf("doDelete");
-        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
+        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
         String message = "DELETE not allowed for the subscribeURL.";
         EventLogRecord elr = new EventLogRecord(req);
         elr.setMessage(message);
@@ -69,15 +70,15 @@
         eventlogger.info(elr);
         resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, message);
     }
+
     /**
-     * GET on the &lt;subscribeUrl&gt; -- get the list of subscriptions to a feed.
-     * See the <i>Subscription Collection Query</i> section in the <b>Provisioning API</b>
-     * document for details on how this method should be invoked.
+     * GET on the &lt;subscribeUrl&gt; -- get the list of subscriptions to a feed. See the <i>Subscription Collection
+     * Query</i> section in the <b>Provisioning API</b> document for details on how this method should be invoked.
      */
     @Override
     public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         setIpAndFqdnForEelf("doGet");
-        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
+        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
         EventLogRecord elr = new EventLogRecord(req);
         String message = isAuthorizedForProvisioning(req);
         if (message != null) {
@@ -93,7 +94,7 @@
         }
         String bhdr = req.getHeader(BEHALF_HEADER);
         if (bhdr == null) {
-            message = "Missing "+BEHALF_HEADER+" header.";
+            message = "Missing " + BEHALF_HEADER + " header.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
             eventlogger.info(elr);
@@ -120,7 +121,7 @@
         }
         // Check with the Authorizer
         AuthorizationResponse aresp = authz.decide(req);
-        if (! aresp.isAuthorized()) {
+        if (!aresp.isAuthorized()) {
             message = "Policy Engine disallows access.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_FORBIDDEN);
@@ -140,13 +141,14 @@
         resp.setContentType(SUBLIST_CONTENT_TYPE);
         resp.getOutputStream().print(t);
     }
+
     /**
      * PUT on the &lt;subscribeUrl&gt; -- not supported.
      */
     @Override
     public void doPut(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         setIpAndFqdnForEelf("doPut");
-        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
+        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
         String message = "PUT not allowed for the subscribeURL.";
         EventLogRecord elr = new EventLogRecord(req);
         elr.setMessage(message);
@@ -154,10 +156,10 @@
         eventlogger.info(elr);
         resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, message);
     }
+
     /**
-     * POST on the &lt;subscribeUrl&gt; -- create a new subscription to a feed.
-     * See the <i>Creating a Subscription</i> section in the <b>Provisioning API</b>
-     * document for details on how this method should be invoked.
+     * POST on the &lt;subscribeUrl&gt; -- create a new subscription to a feed. See the <i>Creating a Subscription</i>
+     * 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 {
@@ -178,7 +180,7 @@
         }
         String bhdr = req.getHeader(BEHALF_HEADER);
         if (bhdr == null) {
-            message = "Missing "+BEHALF_HEADER+" header.";
+            message = "Missing " + BEHALF_HEADER + " header.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
             eventlogger.info(elr);
@@ -205,7 +207,7 @@
         }
         // Check with the Authorizer
         AuthorizationResponse aresp = authz.decide(req);
-        if (! aresp.isAuthorized()) {
+        if (!aresp.isAuthorized()) {
             message = "Policy Engine disallows access.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_FORBIDDEN);
@@ -218,7 +220,7 @@
         ContentHeader ch = getContentHeader(req);
         String ver = ch.getAttribute("version");
         if (!ch.getType().equals(SUB_BASECONTENT_TYPE) || !(ver.equals("1.0") || ver.equals("2.0"))) {
-            intlogger.debug("Content-type is: "+req.getHeader("Content-Type"));
+            intlogger.debug("Content-type is: " + req.getHeader("Content-Type"));
             message = "Incorrect content-type";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
@@ -235,10 +237,11 @@
             resp.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
             return;
         }
-        if (intlogger.isDebugEnabled())
+        if (intlogger.isDebugEnabled()) {
             intlogger.debug(jo.toString());
-        if (++active_subs > max_subs) {
-            active_subs--;
+        }
+        if (++activeSubs > maxSubs) {
+            activeSubs--;
             message = "Cannot create subscription; the maximum number of subscriptions has been configured.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_CONFLICT);
@@ -250,7 +253,7 @@
         try {
             sub = new Subscription(jo);
         } catch (InvalidObjectException e) {
-            active_subs--;
+            activeSubs--;
             message = e.getMessage();
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
@@ -263,8 +266,11 @@
 
         // Check if this subscription already exists; not an error (yet), just warn
         Subscription sub2 = Subscription.getSubscriptionMatching(sub);
-        if (sub2 != null)
-            intlogger.warn("PROV0011 Creating a duplicate subscription: new subid="+sub.getSubid()+", old subid="+sub2.getSubid());
+        if (sub2 != null) {
+            intlogger.warn(
+                "PROV0011 Creating a duplicate subscription: new subid=" + sub.getSubid() + ", old subid=" + sub2
+                    .getSubid());
+        }
 
         // Create SUBSCRIPTIONS table entries
         if (doInsert(sub)) {
@@ -279,7 +285,7 @@
             provisioningDataChanged();
         } else {
             // Something went wrong with the INSERT
-            active_subs--;
+            activeSubs--;
             elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             eventlogger.info(elr);
             resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG);
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 8e49e30..3294580 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
@@ -45,30 +45,30 @@
 import com.att.eelf.configuration.EELFManager;
 
 /**
- * This servlet handles provisioning for the &lt;subscriptionURL&gt; which is generated by the provisioning
- * server to handle the inspection, modification, and deletion of a particular subscription to a feed.
- * It supports DELETE to delete a subscription, GET to retrieve information about the subscription,
- * and PUT to modify the subscription.  In DR 3.0, POST is also supported in order to reset the subscription
- * timers for individual subscriptions.
+ * This servlet handles provisioning for the &lt;subscriptionURL&gt; which is generated by the provisioning server to
+ * handle the inspection, modification, and deletion of a particular subscription to a feed. It supports DELETE to
+ * delete a subscription, GET to retrieve information about the subscription, and PUT to modify the subscription.  In DR
+ * 3.0, POST is also supported in order to reset the subscription timers for individual subscriptions.
  *
  * @author Robert Eby
  * @version $Id$
  */
 @SuppressWarnings("serial")
 public class SubscriptionServlet extends ProxyServlet {
+
     public static final String SUBCNTRL_CONTENT_TYPE = "application/vnd.att-dr.subscription-control";
     //Adding EELF Logger Rally:US664892
-    private static EELFLogger eelflogger = EELFManager.getInstance().getLogger("org.onap.dmaap.datarouter.provisioning.SubscriptionServlet");
+    private static EELFLogger eelflogger = EELFManager.getInstance()
+        .getLogger("org.onap.dmaap.datarouter.provisioning.SubscriptionServlet");
 
     /**
-     * DELETE on the &lt;subscriptionUrl&gt; -- delete a subscription.
-     * See the <i>Deleting a Subscription</i> section in the <b>Provisioning API</b>
-     * document for details on how this method should be invoked.
+     * DELETE on the &lt;subscriptionUrl&gt; -- delete a subscription. See the <i>Deleting a Subscription</i> section in
+     * the <b>Provisioning API</b> document for details on how this method should be invoked.
      */
     @Override
     public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         setIpAndFqdnForEelf("doDelete");
-        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
+        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
         EventLogRecord elr = new EventLogRecord(req);
         String message = isAuthorizedForProvisioning(req);
         if (message != null) {
@@ -84,7 +84,7 @@
         }
         String bhdr = req.getHeader(BEHALF_HEADER);
         if (bhdr == null) {
-            message = "Missing "+BEHALF_HEADER+" header.";
+            message = "Missing " + BEHALF_HEADER + " header.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
             eventlogger.info(elr);
@@ -111,7 +111,7 @@
         }
         // Check with the Authorizer
         AuthorizationResponse aresp = authz.decide(req);
-        if (! aresp.isAuthorized()) {
+        if (!aresp.isAuthorized()) {
             message = "Policy Engine disallows access.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_FORBIDDEN);
@@ -122,7 +122,7 @@
 
         // Delete Subscription
         if (doDelete(sub)) {
-            active_subs--;
+            activeSubs--;
             // send response
             elr.setResult(HttpServletResponse.SC_NO_CONTENT);
             eventlogger.info(elr);
@@ -135,15 +135,16 @@
             resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG);
         }
     }
+
     /**
-     * GET on the &lt;subscriptionUrl&gt; -- get information about a subscription.
-     * See the <i>Retreiving Information about a Subscription</i> section in the <b>Provisioning API</b>
-     * document for details on how this method should be invoked.
+     * GET on the &lt;subscriptionUrl&gt; -- get information about a subscription. See the <i>Retreiving Information
+     * about a Subscription</i> section in the <b>Provisioning API</b> document for details on how this method should be
+     * invoked.
      */
     @Override
     public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         setIpAndFqdnForEelf("doGet");
-        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
+        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
         EventLogRecord elr = new EventLogRecord(req);
         String message = isAuthorizedForProvisioning(req);
         if (message != null) {
@@ -159,7 +160,7 @@
         }
         String bhdr = req.getHeader(BEHALF_HEADER);
         if (bhdr == null) {
-            message = "Missing "+BEHALF_HEADER+" header.";
+            message = "Missing " + BEHALF_HEADER + " header.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
             eventlogger.info(elr);
@@ -186,7 +187,7 @@
         }
         // Check with the Authorizer
         AuthorizationResponse aresp = authz.decide(req);
-        if (! aresp.isAuthorized()) {
+        if (!aresp.isAuthorized()) {
             message = "Policy Engine disallows access.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_FORBIDDEN);
@@ -202,15 +203,15 @@
         resp.setContentType(SUBFULL_CONTENT_TYPE);
         resp.getOutputStream().print(sub.asJSONObject(true).toString());
     }
+
     /**
-     * PUT on the &lt;subscriptionUrl&gt; -- modify a subscription.
-     * See the <i>Modifying a Subscription</i> section in the <b>Provisioning API</b>
-     * document for details on how this method should be invoked.
+     * PUT on the &lt;subscriptionUrl&gt; -- modify a subscription. See the <i>Modifying a Subscription</i> section in
+     * the <b>Provisioning API</b> document for details on how this method should be invoked.
      */
     @Override
     public void doPut(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         setIpAndFqdnForEelf("doPut");
-        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
+        eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
         EventLogRecord elr = new EventLogRecord(req);
         String message = isAuthorizedForProvisioning(req);
         if (message != null) {
@@ -226,7 +227,7 @@
         }
         String bhdr = req.getHeader(BEHALF_HEADER);
         if (bhdr == null) {
-            message = "Missing "+BEHALF_HEADER+" header.";
+            message = "Missing " + BEHALF_HEADER + " header.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
             eventlogger.info(elr);
@@ -253,7 +254,7 @@
         }
         // Check with the Authorizer
         AuthorizationResponse aresp = authz.decide(req);
-        if (! aresp.isAuthorized()) {
+        if (!aresp.isAuthorized()) {
             message = "Policy Engine disallows access.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_FORBIDDEN);
@@ -281,8 +282,9 @@
             resp.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
             return;
         }
-        if (intlogger.isDebugEnabled())
+        if (intlogger.isDebugEnabled()) {
             intlogger.debug(jo.toString());
+        }
         Subscription sub = null;
         try {
             sub = new Subscription(jo);
@@ -335,10 +337,10 @@
             resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG);
         }
     }
+
     /**
-     * POST on the &lt;subscriptionUrl&gt; -- control a subscription.
-     * See the <i>Resetting a Subscription's Retry Schedule</i> section in the <b>Provisioning API</b>
-     * document for details on how this method should be invoked.
+     * POST on the &lt;subscriptionUrl&gt; -- control a subscription. See the <i>Resetting a Subscription's Retry
+     * Schedule</i> 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 {
@@ -367,7 +369,7 @@
         }
         String bhdr = req.getHeader(BEHALF_HEADER);
         if (bhdr == null) {
-            message = "Missing "+BEHALF_HEADER+" header.";
+            message = "Missing " + BEHALF_HEADER + " header.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
             eventlogger.info(elr);
@@ -396,7 +398,7 @@
         }
         // Check with the Authorizer
         AuthorizationResponse aresp = authz.decide(req);
-        if (! aresp.isAuthorized()) {
+        if (!aresp.isAuthorized()) {
             message = "Policy Engine disallows access.";
             elr.setMessage(message);
             elr.setResult(HttpServletResponse.SC_FORBIDDEN);
@@ -437,22 +439,25 @@
     }
 
     /**
-     * A Thread class used to serially send reset notifications to all nodes in the DR network,
-     * when a POST is received for a subscription.
+     * A Thread class used to serially send reset notifications to all nodes in the DR network, when a POST is received
+     * for a subscription.
      */
     public class SubscriberNotifyThread extends Thread {
+
         public static final String URL_TEMPLATE = "http://%s/internal/resetSubscription/%d";
         private List<String> urls = new Vector<String>();
 
         public SubscriberNotifyThread() {
             setName("SubscriberNotifyThread");
         }
+
         public void resetSubscription(int subid) {
             for (String nodename : BaseServlet.getNodes()) {
                 String u = String.format(URL_TEMPLATE, nodename, subid);
                 urls.add(u);
             }
         }
+
         public void run() {
             try {
                 while (!urls.isEmpty()) {
@@ -464,11 +469,11 @@
                         conn.getContentLength();    // Force the GET through
                         conn.disconnect();
                     } catch (IOException e) {
-                        intlogger.info("IOException Error accessing URL: "+u+": " + e.getMessage());
+                        intlogger.info("IOException Error accessing URL: " + u + ": " + e.getMessage());
                     }
                 }
             } catch (Exception e) {
-                intlogger.warn("Caught exception in SubscriberNotifyThread: "+e);
+                intlogger.warn("Caught exception in SubscriberNotifyThread: " + e);
                 e.printStackTrace();
             }
         }
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 898a3f0..9eeac23 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
@@ -89,23 +89,32 @@
  * </ol>
  * <p>For this to work correctly, the following code needs to be placed at the beginning of main().</p>
  * <code>
- *         Security.setProperty("networkaddress.cache.ttl", "10");
+ * Security.setProperty("networkaddress.cache.ttl", "10");
  * </code>
  *
  * @author Robert Eby
  * @version $Id: SynchronizerTask.java,v 1.10 2014/03/21 13:50:10 eby Exp $
  */
 public class SynchronizerTask extends TimerTask {
-    /** This is a singleton -- there is only one SynchronizerTask object in the server */
+
+    /**
+     * This is a singleton -- there is only one SynchronizerTask object in the server
+     */
     private static SynchronizerTask synctask;
 
-    /** This POD is unknown -- not on the list of PODs */
+    /**
+     * This POD is unknown -- not on the list of PODs
+     */
     public static final int UNKNOWN = 0;
-    /** This POD is active -- on the list of PODs, and the DNS CNAME points to us */
+    /**
+     * This POD is active -- on the list of PODs, and the DNS CNAME points to us
+     */
     public static final int ACTIVE = 1;
-    /** This POD is standby -- on the list of PODs, and the DNS CNAME does not point to us */
+    /**
+     * This POD is standby -- on the list of PODs, and the DNS CNAME does not point to us
+     */
     public static final int STANDBY = 2;
-    private static final String[] stnames = { "UNKNOWN", "ACTIVE", "STANDBY" };
+    private static final String[] stnames = {"UNKNOWN", "ACTIVE", "STANDBY"};
     private static final long ONE_HOUR = 60 * 60 * 1000L;
 
     private final Logger logger;
@@ -118,11 +127,13 @@
 
     /**
      * Get the singleton SynchronizerTask object.
+     *
      * @return the SynchronizerTask
      */
     public static synchronized SynchronizerTask getSynchronizer() {
-        if (synctask == null)
+        if (synctask == null) {
             synctask = new SynchronizerTask();
+        }
         return synctask;
     }
 
@@ -138,16 +149,16 @@
         logger.info("PROV5000: Sync task starting, server state is UNKNOWN");
         try {
             Properties props = (new DB()).getProperties();
-            String type  = props.getProperty(Main.KEYSTORE_TYPE_PROPERTY, "jks");
+            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_PASSWORD_PROPERTY);
             KeyStore keyStore = KeyStore.getInstance(type);
             FileInputStream instream = new FileInputStream(new File(store));
             keyStore.load(instream, pass.toCharArray());
             instream.close();
 
             store = props.getProperty(Main.TRUSTSTORE_PATH_PROPERTY);
-            pass  = props.getProperty(Main.TRUSTSTORE_PASSWORD_PROPERTY);
+            pass = props.getProperty(Main.TRUSTSTORE_PASSWORD_PROPERTY);
             KeyStore trustStore = null;
             if (store != null && store.length() > 0) {
                 trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
@@ -158,12 +169,13 @@
 
             // 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
+            String keystorepass = props.getProperty(
+                Main.KEYSTORE_PASSWORD_PROPERTY); //itrack.web.att.com/browse/DATARTR-6 for changing hard coded passphase ref
             AbstractHttpClient hc = new DefaultHttpClient();
             SSLSocketFactory socketFactory =
                 (trustStore == null)
-                ? new SSLSocketFactory(keyStore, keystorepass)
-                : new SSLSocketFactory(keyStore, keystorepass, trustStore);
+                    ? new SSLSocketFactory(keyStore, keystorepass)
+                    : new SSLSocketFactory(keyStore, keystorepass, trustStore);
             socketFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
             Scheme sch = new Scheme("https", 443, socketFactory);
             hc.getConnectionManager().getSchemeRegistry().register(sch);
@@ -179,12 +191,13 @@
             }
             rolex.scheduleAtFixedRate(this, 0L, interval);
         } catch (Exception e) {
-            logger.warn("PROV5005: Problem starting the synchronizer: "+e);
+            logger.warn("PROV5005: Problem starting the synchronizer: " + e);
         }
     }
 
     /**
      * What is the state of this POD?
+     *
      * @return one of ACTIVE, STANDBY, UNKNOWN
      */
     public int getState() {
@@ -193,6 +206,7 @@
 
     /**
      * Is this the active POD?
+     *
      * @return true if we are active (the master), false otherwise
      */
     public boolean isActive() {
@@ -200,8 +214,8 @@
     }
 
     /**
-     * This method is used to signal that another POD (the active POD) has sent us a /fetchProv request,
-     * and that we should re-synchronize with the master.
+     * This method is used to signal that another POD (the active POD) has sent us a /fetchProv request, and that we
+     * should re-synchronize with the master.
      */
     public void doFetch() {
         doFetch = true;
@@ -226,20 +240,23 @@
                     JSONObject jo = readProvisioningJSON();
                     if (jo != null) {
                         doFetch = false;
-                        syncFeeds( jo.getJSONArray("feeds"));
-                        syncSubs(  jo.getJSONArray("subscriptions"));
-                        syncGroups(  jo.getJSONArray("groups")); //Rally:US708115 - 1610
+                        syncFeeds(jo.getJSONArray("feeds"));
+                        syncSubs(jo.getJSONArray("subscriptions"));
+                        syncGroups(jo.getJSONArray("groups")); //Rally:US708115 - 1610
                         syncParams(jo.getJSONObject("parameters"));
                         // The following will not be present in a version=1.0 provfeed
                         JSONArray ja = jo.optJSONArray("ingress");
-                        if (ja != null)
+                        if (ja != null) {
                             syncIngressRoutes(ja);
+                        }
                         JSONObject j2 = jo.optJSONObject("egress");
-                        if (j2 != null)
-                            syncEgressRoutes( j2);
+                        if (j2 != null) {
+                            syncEgressRoutes(j2);
+                        }
                         ja = jo.optJSONArray("routing");
-                        if (ja != null)
+                        if (ja != null) {
                             syncNetworkRoutes(ja);
+                        }
                     }
                     logger.info("PROV5013: Sync completed.");
                     nextsynctime = System.currentTimeMillis() + ONE_HOUR;
@@ -254,53 +271,61 @@
             if (lfl.isIdle()) {
                 // Only fetch new logs if the loader is waiting for them.
                 logger.trace("Checking for logs to replicate...");
-                RLEBitSet local  = lfl.getBitSet();
+                RLEBitSet local = lfl.getBitSet();
                 RLEBitSet remote = readRemoteLoglist();
                 remote.andNot(local);
                 if (!remote.isEmpty()) {
-                    logger.debug(" Replicating logs: "+remote);
+                    logger.debug(" Replicating logs: " + remote);
                     replicateDRLogs(remote);
                 }
             }
         } catch (Exception e) {
-            logger.warn("PROV0020: Caught exception in SynchronizerTask: "+e);
+            logger.warn("PROV0020: Caught exception in SynchronizerTask: " + e);
             e.printStackTrace();
         }
     }
 
     /**
-     * This method is used to lookup the CNAME that points to the active server.
-     * It returns 0 (UNKNOWN), 1(ACTIVE), or 2 (STANDBY) to indicate the state of this server.
+     * This method is used to lookup the CNAME that points to the active server. It returns 0 (UNKNOWN), 1(ACTIVE), or 2
+     * (STANDBY) to indicate the state of this server.
+     *
      * @return the current state
      */
     private int lookupState() {
         int newstate = UNKNOWN;
         try {
             InetAddress myaddr = InetAddress.getLocalHost();
-            if (logger.isTraceEnabled())
-                logger.trace("My address: "+myaddr);
-            String this_pod = myaddr.getHostName();
-            Set<String> pods = new TreeSet<String>(Arrays.asList(BaseServlet.getPods()));
-            if (pods.contains(this_pod)) {
-                InetAddress pserver = InetAddress.getByName(BaseServlet.active_prov_name);
+            if (logger.isTraceEnabled()) {
+                logger.trace("My address: " + myaddr);
+            }
+            String thisPod = myaddr.getHostName();
+            Set<String> pods = new TreeSet<>(Arrays.asList(BaseServlet.getPods()));
+            if (pods.contains(thisPod)) {
+                InetAddress pserver = InetAddress.getByName(BaseServlet.activeProvName);
                 newstate = myaddr.equals(pserver) ? ACTIVE : STANDBY;
-                if (logger.isDebugEnabled() && System.currentTimeMillis() >= next_msg) {
-                    logger.debug("Active POD = "+pserver+", Current state is "+stnames[newstate]);
-                    next_msg = System.currentTimeMillis() + (5 * 60 * 1000L);
+                if (logger.isDebugEnabled() && System.currentTimeMillis() >= nextMsg) {
+                    logger.debug("Active POD = " + pserver + ", Current state is " + stnames[newstate]);
+                    nextMsg = System.currentTimeMillis() + (5 * 60 * 1000L);
                 }
             } else {
-                logger.warn("PROV5003: My name ("+this_pod+") is missing from the list of provisioning servers.");
+                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.");
         }
 
-        if (newstate != state)
-            logger.info(String.format("PROV5001: Server state changed from %s to %s", stnames[state], stnames[newstate]));
+        if (newstate != state) {
+            logger
+                .info(String.format("PROV5001: Server state changed from %s to %s", stnames[state], stnames[newstate]));
+        }
         return newstate;
     }
-    private static long next_msg = 0;    // only display the "Current state" msg every 5 mins.
-    /** Synchronize the Feeds in the JSONArray, with the Feeds in the DB. */
+
+    private static long nextMsg = 0;    // only display the "Current state" msg every 5 mins.
+
+    /**
+     * Synchronize the Feeds in the JSONArray, with the Feeds in the DB.
+     */
     private void syncFeeds(JSONArray ja) {
         Collection<Syncable> coll = new ArrayList<Syncable>();
         for (int n = 0; n < ja.length(); n++) {
@@ -308,13 +333,17 @@
                 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));
             }
         }
-        if (sync(coll, Feed.getAllFeeds()))
+        if (sync(coll, Feed.getAllFeeds())) {
             BaseServlet.provisioningDataChanged();
+        }
     }
-    /** Synchronize the Subscriptions in the JSONArray, with the Subscriptions in the DB. */
+
+    /**
+     * Synchronize the Subscriptions in the JSONArray, with the Subscriptions in the DB.
+     */
     private void syncSubs(JSONArray ja) {
         Collection<Syncable> coll = new ArrayList<Syncable>();
         for (int n = 0; n < ja.length(); n++) {
@@ -325,14 +354,17 @@
                 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));
             }
         }
-        if (sync(coll, Subscription.getAllSubscriptions()))
+        if (sync(coll, Subscription.getAllSubscriptions())) {
             BaseServlet.provisioningDataChanged();
+        }
     }
 
-    /**  Rally:US708115  - Synchronize the Groups in the JSONArray, with the Groups in the DB. */
+    /**
+     * 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>();
         for (int n = 0; n < ja.length(); n++) {
@@ -340,15 +372,18 @@
                 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 subscription: " + ja.optJSONObject(n));
             }
         }
-        if (sync(coll, Group.getAllgroups()))
+        if (sync(coll, Group.getAllgroups())) {
             BaseServlet.provisioningDataChanged();
+        }
     }
 
 
-    /** Synchronize the Parameters in the JSONObject, with the Parameters in the DB. */
+    /**
+     * Synchronize the Parameters in the JSONObject, with the Parameters in the DB.
+     */
     private void syncParams(JSONObject jo) {
         Collection<Syncable> coll = new ArrayList<Syncable>();
         for (String k : jo.keySet()) {
@@ -357,12 +392,13 @@
                 v = jo.getString(k);
             } catch (JSONException e) {
                 try {
-                    v = ""+jo.getInt(k);
+                    v = "" + jo.getInt(k);
                 } catch (JSONException e1) {
                     JSONArray ja = jo.getJSONArray(k);
                     for (int i = 0; i < ja.length(); i++) {
-                        if (i > 0)
+                        if (i > 0) {
                             v += "|";
+                        }
                         v += ja.getString(i);
                     }
                 }
@@ -374,6 +410,7 @@
             BaseServlet.provisioningParametersChanged();
         }
     }
+
     private void syncIngressRoutes(JSONArray ja) {
         Collection<Syncable> coll = new ArrayList<Syncable>();
         for (int n = 0; n < ja.length(); n++) {
@@ -381,12 +418,14 @@
                 IngressRoute in = new IngressRoute(ja.getJSONObject(n));
                 coll.add(in);
             } catch (NumberFormatException e) {
-                logger.warn("PROV5004: Invalid object in ingress routes: "+ja.optJSONObject(n));
+                logger.warn("PROV5004: Invalid object in ingress routes: " + ja.optJSONObject(n));
             }
         }
-        if (sync(coll, IngressRoute.getAllIngressRoutes()))
+        if (sync(coll, IngressRoute.getAllIngressRoutes())) {
             BaseServlet.provisioningDataChanged();
+        }
     }
+
     private void syncEgressRoutes(JSONObject jo) {
         Collection<Syncable> coll = new ArrayList<Syncable>();
         for (String key : jo.keySet()) {
@@ -396,14 +435,16 @@
                 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);
             } catch (IllegalArgumentException e) {
-                logger.warn("PROV5004: Invalid node name in egress routes: "+key);
+                logger.warn("PROV5004: Invalid node name in egress routes: " + key);
             }
         }
-        if (sync(coll, EgressRoute.getAllEgressRoutes()))
+        if (sync(coll, EgressRoute.getAllEgressRoutes())) {
             BaseServlet.provisioningDataChanged();
+        }
     }
+
     private void syncNetworkRoutes(JSONArray ja) {
         Collection<Syncable> coll = new ArrayList<Syncable>();
         for (int n = 0; n < ja.length(); n++) {
@@ -411,12 +452,14 @@
                 NetworkRoute nr = new NetworkRoute(ja.getJSONObject(n));
                 coll.add(nr);
             } catch (JSONException e) {
-                logger.warn("PROV5004: Invalid object in network routes: "+ja.optJSONObject(n));
+                logger.warn("PROV5004: Invalid object in network routes: " + ja.optJSONObject(n));
             }
         }
-        if (sync(coll, NetworkRoute.getAllNetworkRoutes()))
+        if (sync(coll, NetworkRoute.getAllNetworkRoutes())) {
             BaseServlet.provisioningDataChanged();
+        }
     }
+
     private boolean sync(Collection<? extends Syncable> newc, Collection<? extends Syncable> oldc) {
         boolean changes = false;
         try {
@@ -431,18 +474,21 @@
                 Syncable newobj = newmap.get(n);
                 Syncable oldobj = oldmap.get(n);
                 if (oldobj == null) {
-                    if (logger.isDebugEnabled())
-                        logger.debug("  Inserting record: "+newobj);
+                    if (logger.isDebugEnabled()) {
+                        logger.debug("  Inserting record: " + newobj);
+                    }
                     newobj.doInsert(conn);
                     changes = true;
                 } else if (newobj == null) {
-                    if (logger.isDebugEnabled())
-                        logger.debug("  Deleting record: "+oldobj);
+                    if (logger.isDebugEnabled()) {
+                        logger.debug("  Deleting record: " + oldobj);
+                    }
                     oldobj.doDelete(conn);
                     changes = true;
                 } else if (!newobj.equals(oldobj)) {
-                    if (logger.isDebugEnabled())
-                        logger.debug("  Updating record: "+newobj);
+                    if (logger.isDebugEnabled()) {
+                        logger.debug("  Updating record: " + newobj);
+                    }
                     newobj.doUpdate(conn);
 
                     /**Rally US708115
@@ -455,11 +501,12 @@
             }
             db.release(conn);
         } catch (SQLException e) {
-            logger.warn("PROV5009: problem during sync, exception: "+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>();
         for (Syncable v : c) {
@@ -468,29 +515,28 @@
         return map;
     }
 
-
     /**Change owner of FEED/SUBSCRIPTION*/
-    /**Rally US708115
-     * Change Ownership of FEED - 1610
-     *
-     * */
+    /**
+     * Rally US708115 Change Ownership of FEED - 1610
+     */
     private void checkChnageOwner(Syncable newobj, Syncable oldobj) {
-        if(newobj instanceof Feed) {
+        if (newobj instanceof Feed) {
             Feed oldfeed = (Feed) oldobj;
             Feed newfeed = (Feed) newobj;
 
-            if(!oldfeed.getPublisher().equals(newfeed.getPublisher())){
-                logger.info("PROV5013 -  Previous publisher: "+oldfeed.getPublisher() +": New publisher-"+newfeed.getPublisher());
+            if (!oldfeed.getPublisher().equals(newfeed.getPublisher())) {
+                logger.info("PROV5013 -  Previous publisher: " + oldfeed.getPublisher() + ": New publisher-" + newfeed
+                    .getPublisher());
                 oldfeed.setPublisher(newfeed.getPublisher());
                 oldfeed.changeOwnerShip();
             }
-        }
-        else if(newobj instanceof Subscription) {
+        } else if (newobj instanceof Subscription) {
             Subscription oldsub = (Subscription) oldobj;
             Subscription newsub = (Subscription) newobj;
 
-            if(!oldsub.getSubscriber().equals(newsub.getSubscriber())){
-                logger.info("PROV5013 -  Previous subscriber: "+oldsub.getSubscriber() +": New subscriber-"+newsub.getSubscriber());
+            if (!oldsub.getSubscriber().equals(newsub.getSubscriber())) {
+                logger.info("PROV5013 -  Previous subscriber: " + oldsub.getSubscriber() + ": New subscriber-" + newsub
+                    .getSubscriber());
                 oldsub.setSubscriber(newsub.getSubscriber());
                 oldsub.changeOwnerShip();
             }
@@ -500,43 +546,47 @@
 
     /**
      * Issue a GET on the peer POD's /internal/prov/ URL to get a copy of its provisioning data.
+     *
      * @return the provisioning data (as a JONObject)
      */
     private synchronized JSONObject readProvisioningJSON() {
-        String url  = URLUtilities.generatePeerProvURL();
+        String url = URLUtilities.generatePeerProvURL();
         HttpGet get = new HttpGet(url);
         try {
             HttpResponse response = httpclient.execute(get);
             int code = response.getStatusLine().getStatusCode();
             if (code != HttpServletResponse.SC_OK) {
-                logger.warn("PROV5010: readProvisioningJSON failed, bad error code: "+code);
+                logger.warn("PROV5010: readProvisioningJSON failed, bad error code: " + code);
                 return null;
             }
             HttpEntity entity = response.getEntity();
             String ctype = entity.getContentType().getValue().trim();
-            if (!ctype.equals(BaseServlet.PROVFULL_CONTENT_TYPE1) && !ctype.equals(BaseServlet.PROVFULL_CONTENT_TYPE2)) {
-                logger.warn("PROV5011: readProvisioningJSON failed, bad content type: "+ctype);
+            if (!ctype.equals(BaseServlet.PROVFULL_CONTENT_TYPE1) && !ctype
+                .equals(BaseServlet.PROVFULL_CONTENT_TYPE2)) {
+                logger.warn("PROV5011: readProvisioningJSON failed, bad content type: " + ctype);
                 return null;
             }
             return new JSONObject(new JSONTokener(entity.getContent()));
         } catch (Exception e) {
-            logger.warn("PROV5012: readProvisioningJSON failed, exception: "+e);
+            logger.warn("PROV5012: readProvisioningJSON failed, exception: " + e);
             return null;
         } finally {
             get.releaseConnection();
         }
     }
+
     /**
-     * Issue a GET on the peer POD's /internal/drlogs/ URL to get an RELBitSet representing the
-     * log records available in the remote database.
+     * Issue a GET on the peer POD's /internal/drlogs/ URL to get an RELBitSet representing the log records available in
+     * the remote database.
+     *
      * @return the bitset
      */
     private RLEBitSet readRemoteLoglist() {
         RLEBitSet bs = new RLEBitSet();
-        String url  = URLUtilities.generatePeerLogsURL();
+        String url = URLUtilities.generatePeerLogsURL();
 
         //Fixing if only one Prov is configured, not to give exception to fill logs, return empty bitset.
-        if(url.equals("")) {
+        if (url.equals("")) {
             return bs;
         }
         //End of fix.
@@ -546,66 +596,70 @@
             HttpResponse response = httpclient.execute(get);
             int code = response.getStatusLine().getStatusCode();
             if (code != HttpServletResponse.SC_OK) {
-                logger.warn("PROV5010: readRemoteLoglist failed, bad error code: "+code);
+                logger.warn("PROV5010: readRemoteLoglist failed, bad error code: " + code);
                 return bs;
             }
             HttpEntity entity = response.getEntity();
             String ctype = entity.getContentType().getValue().trim();
             if (!ctype.equals("text/plain")) {
-                logger.warn("PROV5011: readRemoteLoglist failed, bad content type: "+ctype);
+                logger.warn("PROV5011: readRemoteLoglist failed, bad content type: " + ctype);
                 return bs;
             }
             InputStream is = entity.getContent();
             ByteArrayOutputStream bos = new ByteArrayOutputStream();
             int ch = 0;
-            while ((ch = is.read()) >= 0)
+            while ((ch = is.read()) >= 0) {
                 bos.write(ch);
+            }
             bs.set(bos.toString());
             is.close();
         } catch (Exception e) {
-            logger.warn("PROV5012: readRemoteLoglist failed, exception: "+e);
+            logger.warn("PROV5012: readRemoteLoglist failed, exception: " + e);
             return bs;
         } finally {
             get.releaseConnection();
         }
         return bs;
     }
+
     /**
-     * Issue a POST on the peer POD's /internal/drlogs/ URL to fetch log records available
-     * in the remote database that we wish to copy to the local database.
+     * Issue a POST on the peer POD's /internal/drlogs/ URL to fetch log records available in the remote database that
+     * we wish to copy to the local database.
+     *
      * @param bs the bitset (an RELBitSet) of log records to fetch
      */
     private void replicateDRLogs(RLEBitSet bs) {
-        String url  = URLUtilities.generatePeerLogsURL();
+        String url = URLUtilities.generatePeerLogsURL();
         HttpPost post = new HttpPost(url);
         try {
             String t = bs.toString();
             HttpEntity body = new ByteArrayEntity(t.getBytes(), ContentType.create("text/plain"));
             post.setEntity(body);
-            if (logger.isDebugEnabled())
-                logger.debug("Requesting records: "+t);
+            if (logger.isDebugEnabled()) {
+                logger.debug("Requesting records: " + t);
+            }
 
             HttpResponse response = httpclient.execute(post);
             int code = response.getStatusLine().getStatusCode();
             if (code != HttpServletResponse.SC_OK) {
-                logger.warn("PROV5010: replicateDRLogs failed, bad error code: "+code);
+                logger.warn("PROV5010: replicateDRLogs failed, bad error code: " + code);
                 return;
             }
             HttpEntity entity = response.getEntity();
             String ctype = entity.getContentType().getValue().trim();
             if (!ctype.equals("text/plain")) {
-                logger.warn("PROV5011: replicateDRLogs failed, bad content type: "+ctype);
+                logger.warn("PROV5011: replicateDRLogs failed, bad content type: " + ctype);
                 return;
             }
 
             String spoolname = "" + System.currentTimeMillis();
             Path tmppath = Paths.get(spooldir, spoolname);
-            Path donepath = Paths.get(spooldir, "IN."+spoolname);
+            Path donepath = Paths.get(spooldir, "IN." + spoolname);
             Files.copy(entity.getContent(), Paths.get(spooldir, spoolname), StandardCopyOption.REPLACE_EXISTING);
             Files.move(tmppath, donepath, StandardCopyOption.REPLACE_EXISTING);
-            logger.info("Approximately "+bs.cardinality()+" records replicated.");
+            logger.info("Approximately " + bs.cardinality() + " records replicated.");
         } catch (Exception e) {
-            logger.warn("PROV5012: replicateDRLogs failed, exception: "+e);
+            logger.warn("PROV5012: replicateDRLogs failed, exception: " + e);
         } finally {
             post.releaseConnection();
         }
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 c65ee26..a907a03 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
@@ -37,11 +37,10 @@
  * @version $Id$
  */
 public class DB {
+
     /**
      * The name of the properties file (in CLASSPATH)
      */
-    private static final String CONFIG_FILE = "provserver.properties";
-
     private static String DB_URL;
     private static String DB_LOGIN;
     private static String DB_PASSWORD;
@@ -53,15 +52,17 @@
     public static String HTTP_PORT;
 
     /**
-     * Construct a DB object.  If this is the very first creation of this object, it will load a copy
-     * of the properties for the server, and attempt to load the JDBC driver for the database.  If a fatal
-     * error occurs (e.g. either the properties file or the DB driver is missing), the JVM will exit.
+     * Construct a DB object.  If this is the very first creation of this object, it will load a copy of the properties
+     * for the server, and attempt to load the JDBC driver for the database.  If a fatal error occurs (e.g. either the
+     * properties file or the DB driver is missing), the JVM will exit.
      */
     public DB() {
         if (props == null) {
             props = new Properties();
-            try (InputStream inStream = getClass().getClassLoader().getResourceAsStream(CONFIG_FILE)) {
-                props.load(inStream);
+            try {
+                props.load(new FileInputStream(System.getProperty(
+                    "org.onap.dmaap.datarouter.provserver.properties",
+                    "/opt/app/datartr/etc/provserver.properties")));
                 String DB_DRIVER = (String) props.get("org.onap.dmaap.datarouter.db.driver");
                 DB_URL = (String) props.get("org.onap.dmaap.datarouter.db.url");
                 DB_LOGIN = (String) props.get("org.onap.dmaap.datarouter.db.login");
@@ -94,7 +95,6 @@
      * Get a JDBC connection to the DB from the pool.  Creates a new one if none are available.
      *
      * @return the Connection
-     * @throws SQLException
      */
     @SuppressWarnings("resource")
     public Connection getConnection() throws SQLException {
@@ -110,8 +110,9 @@
                         try {
                             connection = DriverManager.getConnection(DB_URL, DB_LOGIN, DB_PASSWORD);
                         } catch (SQLException sqlEx) {
-                            if (++n >= 3)
+                            if (++n >= 3) {
                                 throw sqlEx;
+                            }
                         }
                     } while (connection == null);
                 }
@@ -132,15 +133,16 @@
     public void release(Connection connection) {
         if (connection != null) {
             synchronized (queue) {
-                if (!queue.contains(connection))
+                if (!queue.contains(connection)) {
                     queue.add(connection);
+                }
             }
         }
     }
 
     /**
-     * Run all necessary retrofits required to bring the database up to the level required for this version
-     * of the provisioning server.  This should be run before the server itself is started.
+     * Run all necessary retrofits required to bring the database up to the level required for this version of the
+     * provisioning server.  This should be run before the server itself is started.
      *
      * @return true if all retrofits worked, false otherwise
      */
@@ -149,16 +151,15 @@
     }
 
     /**
-     * Retrofit 1 - Make sure the expected tables are in DB and are initialized.
-     * Uses sql_init_01.sql to setup the DB.
+     * Retrofit 1 - Make sure the expected tables are in DB and are initialized. Uses sql_init_01.sql to setup the DB.
      *
      * @return true if the retrofit worked, false otherwise
      */
     private boolean retroFit1() {
         final String[] expectedTables = {
-                "FEEDS", "FEED_ENDPOINT_ADDRS", "FEED_ENDPOINT_IDS", "PARAMETERS",
-                "SUBSCRIPTIONS", "LOG_RECORDS", "INGRESS_ROUTES", "EGRESS_ROUTES",
-                "NETWORK_ROUTES", "NODESETS", "NODES", "GROUPS"
+            "FEEDS", "FEED_ENDPOINT_ADDRS", "FEED_ENDPOINT_IDS", "PARAMETERS",
+            "SUBSCRIPTIONS", "LOG_RECORDS", "INGRESS_ROUTES", "EGRESS_ROUTES",
+            "NETWORK_ROUTES", "NODESETS", "NODES", "GROUPS"
         };
         Connection connection = null;
         try {
@@ -166,7 +167,7 @@
             Set<String> actualTables = getTableSet(connection);
             boolean initialize = false;
             for (String table : expectedTables) {
-                initialize |= !actualTables.contains(table);
+                initialize |= !actualTables.contains(table.toLowerCase());
             }
             if (initialize) {
                 intlogger.info("PROV9001: First time startup; The database is being initialized.");
@@ -176,8 +177,9 @@
             intlogger.fatal("PROV9000: The database credentials are not working: " + e.getMessage());
             return false;
         } finally {
-            if (connection != null)
+            if (connection != null) {
                 release(connection);
+            }
         }
         return true;
     }
@@ -192,7 +194,7 @@
         Set<String> tables = new HashSet<String>();
         try {
             DatabaseMetaData md = connection.getMetaData();
-            ResultSet rs = md.getTables("datarouter", "", "", null);
+            ResultSet rs = md.getTables(null, null, "%", null);
             if (rs != null) {
                 while (rs.next()) {
                     tables.add(rs.getString("TABLE_NAME"));
@@ -200,44 +202,45 @@
                 rs.close();
             }
         } catch (SQLException e) {
+            intlogger.fatal("PROV9010: Failed to get TABLE data from DB: " + e.getMessage());
         }
         return tables;
     }
 
     /**
-     * Initialize the tables by running the initialization scripts located in the directory specified
-     * by the property <i>org.onap.dmaap.datarouter.provserver.dbscripts</i>.  Scripts have names of
-     * the form sql_init_NN.sql
+     * Initialize the tables by running the initialization scripts located in the directory specified by the property
+     * <i>org.onap.dmaap.datarouter.provserver.dbscripts</i>.  Scripts have names of the form sql_init_NN.sql
      *
      * @param connection a DB connection
-     * @param scriptId   the number of the sql_init_NN.sql script to run
+     * @param scriptId the number of the sql_init_NN.sql script to run
      */
     private void runInitScript(Connection connection, int scriptId) {
         String scriptDir = (String) props.get("org.onap.dmaap.datarouter.provserver.dbscripts");
-        StringBuilder sb = new StringBuilder();
+        StringBuilder strBuilder = new StringBuilder();
         try {
             String scriptFile = String.format("%s/sql_init_%02d.sql", scriptDir, scriptId);
-            if (!(new File(scriptFile)).exists())
-                return;
-
-            LineNumberReader in = new LineNumberReader(new FileReader(scriptFile));
+            if (!(new File(scriptFile)).exists()) {
+                intlogger.fatal("PROV9005 Failed to load sql script from : " + scriptFile);
+                System.exit(1);
+            }
+            LineNumberReader lineReader = new LineNumberReader(new FileReader(scriptFile));
             String line;
-            while ((line = in.readLine()) != null) {
+            while ((line = lineReader.readLine()) != null) {
                 if (!line.startsWith("--")) {
                     line = line.trim();
-                    sb.append(line);
+                    strBuilder.append(line);
                     if (line.endsWith(";")) {
                         // Execute one DDL statement
-                        String sql = sb.toString();
-                        sb.setLength(0);
-                        Statement s = connection.createStatement();
-                        s.execute(sql);
-                        s.close();
+                        String sql = strBuilder.toString();
+                        strBuilder.setLength(0);
+                        Statement statement = connection.createStatement();
+                        statement.execute(sql);
+                        statement.close();
                     }
                 }
             }
-            in.close();
-            sb.setLength(0);
+            lineReader.close();
+            strBuilder.setLength(0);
         } catch (Exception e) {
             intlogger.fatal("PROV9002 Error when initializing table: " + e.getMessage());
             System.exit(1);
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 c3661ba..b58ab5a 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
@@ -37,6 +37,7 @@
  * @version $Id: URLUtilities.java,v 1.2 2014/03/12 19:45:41 eby Exp $
  */
 public class URLUtilities {
+
     /**
      * Generate the URL used to access a feed.
      *
@@ -44,7 +45,7 @@
      * @return the URL
      */
     public static String generateFeedURL(int feedid) {
-        return "https://" + BaseServlet.prov_name + "/feed/" + feedid;
+        return "https://" + BaseServlet.provName + "/feed/" + feedid;
     }
 
     /**
@@ -54,7 +55,7 @@
      * @return the URL
      */
     public static String generatePublishURL(int feedid) {
-        return "https://" + BaseServlet.prov_name + "/publish/" + feedid;
+        return "https://" + BaseServlet.provName + "/publish/" + feedid;
     }
 
     /**
@@ -64,7 +65,7 @@
      * @return the URL
      */
     public static String generateSubscribeURL(int feedid) {
-        return "https://" + BaseServlet.prov_name + "/subscribe/" + feedid;
+        return "https://" + BaseServlet.provName + "/subscribe/" + feedid;
     }
 
     /**
@@ -74,7 +75,7 @@
      * @return the URL
      */
     public static String generateFeedLogURL(int feedid) {
-        return "https://" + BaseServlet.prov_name + "/feedlog/" + feedid;
+        return "https://" + BaseServlet.provName + "/feedlog/" + feedid;
     }
 
     /**
@@ -84,7 +85,7 @@
      * @return the URL
      */
     public static String generateSubscriptionURL(int subid) {
-        return "https://" + BaseServlet.prov_name + "/subs/" + subid;
+        return "https://" + BaseServlet.provName + "/subs/" + subid;
     }
 
     /**
@@ -94,7 +95,7 @@
      * @return the URL
      */
     public static String generateSubLogURL(int subid) {
-        return "https://" + BaseServlet.prov_name + "/sublog/" + subid;
+        return "https://" + BaseServlet.provName + "/sublog/" + subid;
     }
 
     /**
@@ -137,8 +138,9 @@
             }
             System.out.println("ALL PODS: " + Arrays.asList(BaseServlet.getPods()));
             for (String pod : BaseServlet.getPods()) {
-                if (!pod.equals(this_pod))
+                if (!pod.equals(this_pod)) {
                     other_pod = pod;
+                }
             }
         }
         return other_pod;
diff --git a/datarouter-prov/src/main/resources/docker-compose/database/sql_init_01.sql b/datarouter-prov/src/main/resources/docker-compose/database/sql_init_01.sql
new file mode 100644
index 0000000..e01ce3b
--- /dev/null
+++ b/datarouter-prov/src/main/resources/docker-compose/database/sql_init_01.sql
@@ -0,0 +1,145 @@
+use datarouter;
+
+CREATE TABLE FEEDS (
+    FEEDID         INT UNSIGNED NOT NULL PRIMARY KEY,
+    GROUPID        INT(10) UNSIGNED NOT NULL DEFAULT 0,
+    NAME           VARCHAR(255) NOT NULL,
+    VERSION        VARCHAR(20) NOT NULL,
+    DESCRIPTION    VARCHAR(1000),
+    BUSINESS_DESCRIPTION VARCHAR(1000) DEFAULT NULL,
+    AUTH_CLASS     VARCHAR(32) NOT NULL,
+    PUBLISHER      VARCHAR(8) NOT NULL,
+    SELF_LINK      VARCHAR(256),
+    PUBLISH_LINK   VARCHAR(256),
+    SUBSCRIBE_LINK VARCHAR(256),
+    LOG_LINK       VARCHAR(256),
+    DELETED        BOOLEAN DEFAULT FALSE,
+    LAST_MOD       TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+    SUSPENDED      BOOLEAN DEFAULT FALSE,
+    CREATED_DATE   TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE TABLE FEED_ENDPOINT_IDS (
+    FEEDID        INT UNSIGNED NOT NULL,
+    USERID        VARCHAR(20) NOT NULL,
+    PASSWORD      VARCHAR(32) NOT NULL
+);
+
+CREATE TABLE FEED_ENDPOINT_ADDRS (
+    FEEDID        INT UNSIGNED NOT NULL,
+    ADDR          VARCHAR(44) NOT NULL
+);
+
+CREATE TABLE SUBSCRIPTIONS (
+    SUBID              INT UNSIGNED NOT NULL PRIMARY KEY,
+    FEEDID             INT UNSIGNED NOT NULL,
+    GROUPID            INT(10) UNSIGNED NOT NULL DEFAULT 0,
+    DELIVERY_URL       VARCHAR(256),
+    DELIVERY_USER      VARCHAR(20),
+    DELIVERY_PASSWORD  VARCHAR(32),
+    DELIVERY_USE100    BOOLEAN DEFAULT FALSE,
+    METADATA_ONLY      BOOLEAN DEFAULT FALSE,
+    SUBSCRIBER         VARCHAR(8) NOT NULL,
+    SELF_LINK          VARCHAR(256),
+    LOG_LINK           VARCHAR(256),
+    LAST_MOD           TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+    SUSPENDED          BOOLEAN DEFAULT FALSE,
+    CREATED_DATE       TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+
+);
+
+CREATE TABLE PARAMETERS (
+    KEYNAME        VARCHAR(32) NOT NULL PRIMARY KEY,
+    VALUE          VARCHAR(4096) NOT NULL
+);
+
+CREATE TABLE LOG_RECORDS (
+    TYPE           ENUM('pub', 'del', 'exp', 'pbf', 'dlx') NOT NULL,
+    EVENT_TIME     BIGINT NOT NULL,           /* time of the publish request */
+    PUBLISH_ID     VARCHAR(64) NOT NULL,      /* unique ID assigned to this publish attempt */
+    FEEDID         INT UNSIGNED NOT NULL,     /* pointer to feed in FEEDS */
+    REQURI         VARCHAR(256) NOT NULL,     /* request URI */
+    METHOD         ENUM('DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'POST', 'TRACE') NOT NULL, /* HTTP method */
+    CONTENT_TYPE   VARCHAR(256) NOT NULL,     /* content type of published file */
+    CONTENT_LENGTH BIGINT NOT NULL,  /* content length of published file */
+
+    FEED_FILEID    VARCHAR(256),        /* file ID of published file */
+    REMOTE_ADDR    VARCHAR(40),         /* IP address of publishing endpoint */
+    USER           VARCHAR(50),         /* user name of publishing endpoint */
+    STATUS         SMALLINT,            /* status code returned to delivering agent */
+
+    DELIVERY_SUBID INT UNSIGNED,        /* pointer to subscription in SUBSCRIPTIONS */
+    DELIVERY_FILEID  VARCHAR(256),      /* file ID of file being delivered */
+    RESULT         SMALLINT,            /* result received from subscribing agent */
+
+    ATTEMPTS       INT,             /* deliveries attempted */
+    REASON         ENUM('notRetryable', 'retriesExhausted', 'diskFull', 'other'),
+
+    RECORD_ID      BIGINT UNSIGNED NOT NULL PRIMARY KEY, /* unique ID for this record */
+    CONTENT_LENGTH_2 BIGINT,
+
+    INDEX (FEEDID) USING BTREE,
+    INDEX (DELIVERY_SUBID) USING BTREE,
+    INDEX (RECORD_ID) USING BTREE
+) ENGINE = MyISAM;
+
+CREATE TABLE INGRESS_ROUTES (
+    SEQUENCE  INT UNSIGNED NOT NULL,
+    FEEDID    INT UNSIGNED NOT NULL,
+    USERID    VARCHAR(20),
+    SUBNET    VARCHAR(44),
+    NODESET   INT UNSIGNED NOT NULL
+);
+
+CREATE TABLE EGRESS_ROUTES (
+    SUBID    INT UNSIGNED NOT NULL PRIMARY KEY,
+    NODEID   INT UNSIGNED NOT NULL
+);
+
+CREATE TABLE NETWORK_ROUTES (
+    FROMNODE INT UNSIGNED NOT NULL,
+    TONODE   INT UNSIGNED NOT NULL,
+    VIANODE  INT UNSIGNED NOT NULL
+);
+
+CREATE TABLE NODESETS (
+    SETID   INT UNSIGNED NOT NULL,
+    NODEID  INT UNSIGNED NOT NULL
+);
+
+CREATE TABLE NODES (
+    NODEID  INT UNSIGNED NOT NULL PRIMARY KEY,
+    NAME    VARCHAR(255) NOT NULL,
+    ACTIVE  BOOLEAN DEFAULT TRUE
+);
+
+CREATE TABLE GROUPS (
+    GROUPID        INT UNSIGNED NOT NULL PRIMARY KEY,
+    AUTHID         VARCHAR(100) NOT NULL,
+    NAME           VARCHAR(50) NOT NULL,
+    DESCRIPTION    VARCHAR(255),
+    CLASSIFICATION VARCHAR(20) NOT NULL,
+    MEMBERS        TINYTEXT,
+    LAST_MOD       TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+);
+
+INSERT INTO PARAMETERS VALUES
+    ('ACTIVE_POD',  'prov.datarouternew.com'),
+    ('PROV_ACTIVE_NAME',  'prov.datarouternew.com'),
+    ('STANDBY_POD', ''),
+    ('PROV_NAME',   'prov.datarouternew.com'),
+    ('NODES',       '172.100.0.1|node.datarouternew.com'),
+    ('PROV_DOMAIN', 'datarouternew.com'),
+    ('DELIVERY_INIT_RETRY_INTERVAL', '10'),
+    ('DELIVERY_MAX_AGE', '86400'),
+    ('DELIVERY_MAX_RETRY_INTERVAL', '3600'),
+    ('DELIVERY_RETRY_RATIO', '2'),
+    ('LOGROLL_INTERVAL', '300'),
+    ('PROV_AUTH_ADDRESSES', '172.100.0.1|prov.datarouternew.com|node.datarouternew.com'),
+    ('PROV_AUTH_SUBJECTS', ''),
+    ('PROV_MAXFEED_COUNT',  '10000'),
+    ('PROV_MAXSUB_COUNT',   '100000'),
+    ('PROV_REQUIRE_CERT', 'false'),
+    ('PROV_REQUIRE_SECURE', 'false'),
+    ('_INT_VALUES', 'LOGROLL_INTERVAL|PROV_MAXFEED_COUNT|PROV_MAXSUB_COUNT|DELIVERY_INIT_RETRY_INTERVAL|DELIVERY_MAX_RETRY_INTERVAL|DELIVERY_RETRY_RATIO|DELIVERY_MAX_AGE')
+    ;
diff --git a/datarouter-prov/src/main/resources/docker-compose/docker-compose.yml b/datarouter-prov/src/main/resources/docker-compose/docker-compose.yml
index eece155..6aee4db 100644
--- a/datarouter-prov/src/main/resources/docker-compose/docker-compose.yml
+++ b/datarouter-prov/src/main/resources/docker-compose/docker-compose.yml
@@ -30,11 +30,9 @@
      - "8443:8443"
      - "8080:8080"  
     volumes:
-     - ./prov_data/proserver.properties:/opt/app/datartr/etc/proserver.properties
-#     - ./prov_data/datarouter-prov-jar-with-dependencies.jar:/opt/app/datartr/lib/datarouter-prov-jar-with-dependencies.jar
+     - ./prov_data/provserver.properties:/opt/app/datartr/etc/provserver.properties
      - ./prov_data/addSubscriber.txt:/opt/app/datartr/addSubscriber.txt
      - ./prov_data/addFeed3.txt:/opt/app/datartr/addFeed3.txt
-    entrypoint: ["bash", "-c", "./startup.sh"]
     depends_on:
       mariadb_container:
         condition: service_healthy
@@ -58,7 +56,6 @@
      - "9090:8080"
     volumes:
      - ./node_data/node.properties:/opt/app/datartr/etc/node.properties
-    entrypoint: ["bash", "-c", "./startup.sh"]
     depends_on:
       datarouter-prov:
         condition: service_healthy
@@ -73,15 +70,17 @@
     container_name: mariadb
     ports:
       - "3306:3306"
+#    volumes:
+#     - ./database/sql_init_01.sql:/docker-entrypoint-initdb.d/sql_init_01.sql
     environment:
       MYSQL_ROOT_PASSWORD: datarouter
       MYSQL_DATABASE: datarouter
       MYSQL_USER: datarouter
       MYSQL_PASSWORD: datarouter
     healthcheck:
-      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
+      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "--silent"]
       interval: 10s
-      timeout: 10s
+      timeout: 30s
       retries: 5
 
     networks:
diff --git a/datarouter-prov/src/main/resources/docker-compose/prov_data/provserver.properties b/datarouter-prov/src/main/resources/docker-compose/prov_data/provserver.properties
index d733cc2..10bb5eb 100644
--- a/datarouter-prov/src/main/resources/docker-compose/prov_data/provserver.properties
+++ b/datarouter-prov/src/main/resources/docker-compose/prov_data/provserver.properties
@@ -24,22 +24,24 @@
 #Jetty Server properties
 org.onap.dmaap.datarouter.provserver.http.port           = 8080
 org.onap.dmaap.datarouter.provserver.https.port          = 8443
-org.onap.dmaap.datarouter.provserver.https.relaxation       = false
-org.onap.dmaap.datarouter.provserver.keymanager.password = changeit
+org.onap.dmaap.datarouter.provserver.https.relaxation    = false
+
 org.onap.dmaap.datarouter.provserver.keystore.type       = jks
+org.onap.dmaap.datarouter.provserver.keymanager.password = changeit
 org.onap.dmaap.datarouter.provserver.keystore.path       = /opt/app/datartr/self_signed/keystore.jks
-
 org.onap.dmaap.datarouter.provserver.keystore.password   = changeit
-#org.onap.dmaap.datarouter.provserver.truststore.path     = /home/eby/dr2/misc/cacerts+1
-#org.onap.dmaap.datarouter.provserver.truststore.path     = /usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts
 org.onap.dmaap.datarouter.provserver.truststore.path     = /opt/app/datartr/self_signed/cacerts.jks
-
 org.onap.dmaap.datarouter.provserver.truststore.password = changeit
+
 org.onap.dmaap.datarouter.provserver.accesslog.dir       = /opt/app/datartr/logs
 org.onap.dmaap.datarouter.provserver.spooldir            = /opt/app/datartr/spool
 org.onap.dmaap.datarouter.provserver.dbscripts           = /opt/app/datartr/etc/misc
 org.onap.dmaap.datarouter.provserver.logretention        = 30
 
+#DMAAP-597 (Tech Dept) REST request source IP auth
+# relaxation to accommodate OOM kubernetes deploy
+org.onap.dmaap.datarouter.provserver.isaddressauthenabled = true
+
 # Database access
 org.onap.dmaap.datarouter.db.driver   = org.mariadb.jdbc.Driver
 org.onap.dmaap.datarouter.db.url      = jdbc:mariadb://172.100.0.2:3306/datarouter
diff --git a/datarouter-prov/src/main/resources/docker/startup.sh b/datarouter-prov/src/main/resources/docker/startup.sh
index e964f66..ba0f735 100644
--- a/datarouter-prov/src/main/resources/docker/startup.sh
+++ b/datarouter-prov/src/main/resources/docker/startup.sh
@@ -13,5 +13,4 @@
 
 runner_file="$LIB/datarouter-prov-jar-with-dependencies.jar"
 echo "Starting using" $runner_file
-java -Dcom.att.eelf.logging.file==/opt/app/datartr/etc/logback.xml -Dcom.att.eelf.logging.path=/root -jar $runner_file
-
+java -Dorg.onap.dmaap.datarouter.provserver.properties=/opt/app/datartr/etc/provserver.properties -Dcom.att.eelf.logging.file=/opt/app/datartr/etc/logback.xml -Dcom.att.eelf.logging.path=/root -jar $runner_file
\ No newline at end of file
diff --git a/datarouter-prov/src/main/resources/misc/provcmd b/datarouter-prov/src/main/resources/misc/provcmd
index 75d0bff..e3654eb 100644
--- a/datarouter-prov/src/main/resources/misc/provcmd
+++ b/datarouter-prov/src/main/resources/misc/provcmd
@@ -19,6 +19,21 @@
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 
+urlencode() {
+    local data
+    if [[ $# != 1 ]]; then
+        echo "Usage: $0 string-to-urlencode"
+        return 1
+    fi
+    data="$(curl -s -o /dev/null -w %url_effective --get --data-urlencode "$1" "")"
+    if [[ $? != 3 ]]; then
+        echo "Unexpected error" 1>&2
+        return 2
+    fi
+    echo "${data##/?}"
+    return 0
+}
+export urlencode
 
 PATH=/opt/app/datartr/bin:/bin:/usr/bin:$PATH
 PROVCMD="$0"
diff --git a/datarouter-prov/src/main/resources/misc/sql_init_01.sql b/datarouter-prov/src/main/resources/misc/sql_init_01.sql
index e1dfd0c..e01ce3b 100644
--- a/datarouter-prov/src/main/resources/misc/sql_init_01.sql
+++ b/datarouter-prov/src/main/resources/misc/sql_init_01.sql
@@ -114,12 +114,12 @@
 );
 
 CREATE TABLE GROUPS (
-    GROUPID  INT UNSIGNED NOT NULL PRIMARY KEY,
-    AUTHID    VARCHAR(100) NOT NULL,
-    NAME    VARCHAR(50) NOT NULL,
+    GROUPID        INT UNSIGNED NOT NULL PRIMARY KEY,
+    AUTHID         VARCHAR(100) NOT NULL,
+    NAME           VARCHAR(50) NOT NULL,
     DESCRIPTION    VARCHAR(255),
-    CLASSIFICATION    VARCHAR(20) NOT NULL,
-    MEMBERS    TINYTEXT,
+    CLASSIFICATION VARCHAR(20) NOT NULL,
+    MEMBERS        TINYTEXT,
     LAST_MOD       TIMESTAMP DEFAULT CURRENT_TIMESTAMP
 );
 
@@ -143,6 +143,3 @@
     ('PROV_REQUIRE_SECURE', 'false'),
     ('_INT_VALUES', 'LOGROLL_INTERVAL|PROV_MAXFEED_COUNT|PROV_MAXSUB_COUNT|DELIVERY_INIT_RETRY_INTERVAL|DELIVERY_MAX_RETRY_INTERVAL|DELIVERY_RETRY_RATIO|DELIVERY_MAX_AGE')
     ;
-
-INSERT INTO FEED_ENDPOINT_ADDRS VALUES
-    (1,  '172.100.0.1');
\ No newline at end of file
diff --git a/datarouter-prov/src/main/resources/provserver.properties b/datarouter-prov/src/main/resources/provserver.properties
index 28ffb98..10bb5eb 100644
--- a/datarouter-prov/src/main/resources/provserver.properties
+++ b/datarouter-prov/src/main/resources/provserver.properties
@@ -24,22 +24,24 @@
 #Jetty Server properties
 org.onap.dmaap.datarouter.provserver.http.port           = 8080
 org.onap.dmaap.datarouter.provserver.https.port          = 8443
-org.onap.dmaap.datarouter.provserver.https.relaxation       = false
-org.onap.dmaap.datarouter.provserver.keymanager.password = changeit
+org.onap.dmaap.datarouter.provserver.https.relaxation    = false
+
 org.onap.dmaap.datarouter.provserver.keystore.type       = jks
+org.onap.dmaap.datarouter.provserver.keymanager.password = changeit
 org.onap.dmaap.datarouter.provserver.keystore.path       = /opt/app/datartr/self_signed/keystore.jks
-
 org.onap.dmaap.datarouter.provserver.keystore.password   = changeit
-#org.onap.dmaap.datarouter.provserver.truststore.path     = /home/eby/dr2/misc/cacerts+1
-#org.onap.dmaap.datarouter.provserver.truststore.path     = /usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts
 org.onap.dmaap.datarouter.provserver.truststore.path     = /opt/app/datartr/self_signed/cacerts.jks
-
 org.onap.dmaap.datarouter.provserver.truststore.password = changeit
+
 org.onap.dmaap.datarouter.provserver.accesslog.dir       = /opt/app/datartr/logs
 org.onap.dmaap.datarouter.provserver.spooldir            = /opt/app/datartr/spool
-org.onap.dmaap.datarouter.provserver.dbscripts          = /opt/app/datartr/etc/misc
+org.onap.dmaap.datarouter.provserver.dbscripts           = /opt/app/datartr/etc/misc
 org.onap.dmaap.datarouter.provserver.logretention        = 30
 
+#DMAAP-597 (Tech Dept) REST request source IP auth
+# relaxation to accommodate OOM kubernetes deploy
+org.onap.dmaap.datarouter.provserver.isaddressauthenabled = true
+
 # Database access
 org.onap.dmaap.datarouter.db.driver   = org.mariadb.jdbc.Driver
 org.onap.dmaap.datarouter.db.url      = jdbc:mariadb://172.100.0.2:3306/datarouter
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/AllTests.java b/datarouter-prov/src/test/java/datarouter/provisioning/AllTests.java
index 34fb144..33a34c0 100644
--- a/datarouter-prov/src/test/java/datarouter/provisioning/AllTests.java
+++ b/datarouter-prov/src/test/java/datarouter/provisioning/AllTests.java
@@ -30,20 +30,21 @@
 
 @RunWith(Suite.class)
 @SuiteClasses({
-        IntegrationTestDrFeedsPost.class,
-        IntegrationTestDrFeedsGet.class,
-        IntegrationTestDrFeedsPut.class,
-        IntegrationTestDrFeedsDelete.class,
-        IntegrationTestFeedPut.class,
-        IntegrationTestSubscribePost.class,
-        IntegrationTestInternalGet.class,
-        IntegrationTestInternalMisc.class,
-        IntegrationTestPublish.class,
-        IntegrationTestLogGet.class,
-        IntegrationTestFeedDelete.class,
-        IntegrationTestCleanup.class,
-        IntegrationTestRleBitSet.class
-    })
+    IntegrationTestDrFeedsPost.class,
+    IntegrationTestDrFeedsPut.class,
+    IntegrationTestDrFeedsDelete.class,
+    IntegrationTestFeedPut.class,
+    IntegrationTestDrFeedsGet.class,
+    IntegrationTestInternalGet.class,
+    IntegrationTestInternalMisc.class,
+    IntegrationTestPublish.class,
+    IntegrationTestSubscribePost.class,
+    IntegrationTestLogGet.class,
+    IntegrationTestFeedDelete.class,
+    IntegrationTestCleanup.class,
+    IntegrationTestRleBitSet.class
+})
 
 public class AllTests {
+
 }
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/DbTestData.java b/datarouter-prov/src/test/java/datarouter/provisioning/DbTestData.java
new file mode 100644
index 0000000..36a2eb0
--- /dev/null
+++ b/datarouter-prov/src/test/java/datarouter/provisioning/DbTestData.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * ============LICENSE_START==================================================
+ * * org.onap.dmaap
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * ===========================================================================
+ * * Licensed under the Apache License, Version 2.0 (the "License");
+ * * you may not use this file except in compliance with the License.
+ * * You may obtain a copy of the License at
+ * *
+ *  *      http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ *  * Unless required by applicable law or agreed to in writing, software
+ * * distributed under the License is distributed on an "AS IS" BASIS,
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * * See the License for the specific language governing permissions and
+ * * limitations under the License.
+ * * ============LICENSE_END====================================================
+ * *
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * *
+ ******************************************************************************/
+
+package datarouter.provisioning;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.entity.ContentType;
+import org.apache.http.impl.client.AbstractHttpClient;
+import org.apache.http.util.EntityUtils;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.onap.dmaap.datarouter.provisioning.FeedServlet;
+
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * The DbTestData class
+ *
+ * @version 1.0.1
+ */
+public class DbTestData {
+
+    private static boolean dbReady = false;
+
+    public static void populateDb(AbstractHttpClient httpclient, Properties props) {
+        if (!dbReady) {
+            JSONObject jo = buildFeedRequest();
+            for (int i = 0; i < 10; i++) {
+                jo.put("version", "" + System.currentTimeMillis());
+                int statusCode = -1;
+                String url = props.getProperty("test.host");
+                HttpPost httpPost = new HttpPost(url);
+                try {
+                    httpPost.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
+                    String feedRequestString = jo.toString();
+                    HttpEntity body = new ByteArrayEntity(feedRequestString.getBytes(),
+                        ContentType.create(FeedServlet.FEED_CONTENT_TYPE));
+                    httpPost.setEntity(body);
+                    HttpResponse response = httpclient.execute(httpPost);
+                    statusCode = response.getStatusLine().getStatusCode();
+                    HttpEntity entity = response.getEntity();
+                    EntityUtils.consume(entity);
+                } catch (IOException e) {
+                    System.err.println(e);
+                } finally {
+                    httpPost.releaseConnection();
+                }
+                System.out.println(i + " " + statusCode);
+            }
+            dbReady = true;
+        }
+    }
+
+    private static JSONObject buildFeedRequest() {
+        JSONObject jo = new JSONObject();
+        jo.put("name", "feed");
+        jo.put("version", "" + System.currentTimeMillis());
+        jo.put("description", "Sample feed used by JUnit to test");
+
+        JSONObject jo2 = new JSONObject();
+        jo2.put("classification", "unrestricted");
+
+        JSONObject jo3 = new JSONObject();
+        jo3.put("id", "id001");
+        jo3.put("password", "re1kwelj");
+
+        JSONObject jo4 = new JSONObject();
+        jo4.put("id", "id002");
+        jo4.put("password", "o9eqlmbd");
+
+        JSONArray ja = new JSONArray();
+        ja.put(jo3);
+        ja.put(jo4);
+        jo2.put("endpoint_ids", ja);
+
+        ja = new JSONArray();
+        ja.put("10.0.0.1");
+        ja.put("192.168.0.1");
+        ja.put("135.207.136.128/25");
+        jo2.put("endpoint_addrs", ja);
+
+        jo.put("authorization", jo2);
+        return jo;
+    }
+}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/FillDB.java b/datarouter-prov/src/test/java/datarouter/provisioning/FillDB.java
deleted file mode 100644
index fd682bb..0000000
--- a/datarouter-prov/src/test/java/datarouter/provisioning/FillDB.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- *  *      http://www.apache.org/licenses/LICENSE-2.0
- * *
- *  * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.security.KeyManagementException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.UnrecoverableKeyException;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.ssl.SSLSocketFactory;
-import org.apache.http.entity.ByteArrayEntity;
-import org.apache.http.entity.ContentType;
-import org.apache.http.impl.client.AbstractHttpClient;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.util.EntityUtils;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-
-/**
- * The FillDB class
- *
- * @version 1.0.1
- */
-public class FillDB {
-    /**
-     * This is the main method of the FillDB class.
-     *
-     * @throws KeyStoreException KeyStore exception
-     * @throws FileNotFoundException Exeception thrown when error locating file
-     * @throws KeyManagementException KeyManagement exception
-     * @throws UnrecoverableKeyException Exception thrown when Key cannot be recovered
-     * @throws NoSuchAlgorithmException Exception thrown when algorithm does not exist
-     */
-    public static void main(String[] args)
-        throws KeyStoreException, FileNotFoundException, KeyManagementException, UnrecoverableKeyException,
-            NoSuchAlgorithmException {
-        AbstractHttpClient httpclient = new DefaultHttpClient();
-
-        String keystore = "/home/eby/dr2/misc/client.keystore";
-        String kspass   = "changeit";
-        KeyStore trustStore  = KeyStore.getInstance(KeyStore.getDefaultType());
-        FileInputStream instream = new FileInputStream(new File(keystore));
-        try {
-            trustStore.load(instream, kspass.toCharArray());
-        } catch (Exception x) {
-            System.err.println("READING KEYSTORE: " + x);
-        } finally {
-            try {
-                instream.close();
-            } catch (Exception ignore) {
-                // Ignore exception
-            }
-        }
-
-        SSLSocketFactory socketFactory = new SSLSocketFactory(trustStore, "changeit", trustStore);
-        Scheme sch = new Scheme("https", 443, socketFactory);
-        httpclient.getConnectionManager().getSchemeRegistry().register(sch);
-
-        JSONObject jo = buildFeedRequest();
-        for (int i = 0; i < 10000; i++) {
-            jo.put("version", "" + System.currentTimeMillis());
-            int rv = -1;
-            String url   = "https://conwy.proto.research.att.com:6443/";
-            HttpPost httpPost = new HttpPost(url);
-            try {
-                httpPost.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
-                String feedRequestString = jo.toString();
-                HttpEntity body = new ByteArrayEntity(feedRequestString.getBytes(),
-                        ContentType.create(FeedServlet.FEED_CONTENT_TYPE));
-                httpPost.setEntity(body);
-
-                HttpResponse response = httpclient.execute(httpPost);
-                rv = response.getStatusLine().getStatusCode();
-                HttpEntity entity = response.getEntity();
-                EntityUtils.consume(entity);
-            } catch (IOException e) {
-                System.err.println(e);
-            } finally {
-                httpPost.releaseConnection();
-            }
-            System.out.println(i + " " + rv);
-        }
-    }
-
-    private static JSONObject buildFeedRequest() {
-        JSONObject jo = new JSONObject();
-        jo.put("name", "feed");
-        jo.put("version", "" + System.currentTimeMillis());
-        jo.put("description", "Sample feed used by JUnit to test");
-
-        JSONObject jo2 = new JSONObject();
-        jo2.put("classification", "unrestricted");
-
-
-        JSONObject jo3 = new JSONObject();
-        jo3.put("id", "id001");
-        jo3.put("password", "re1kwelj");
-
-        JSONObject jo4 = new JSONObject();
-        jo4.put("id", "id002");
-        jo4.put("password", "o9eqlmbd");
-
-        JSONArray ja = new JSONArray();
-        ja.put(jo3);
-        ja.put(jo4);
-        jo2.put("endpoint_ids", ja);
-
-        ja = new JSONArray();
-        ja.put("10.0.0.1");
-        ja.put("192.168.0.1");
-        ja.put("135.207.136.128/25");
-        jo2.put("endpoint_addrs", ja);
-
-        jo.put("authorization", jo2);
-        return jo;
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestBase.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestBase.java
index 52e80a8..7144621 100644
--- a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestBase.java
+++ b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestBase.java
@@ -49,14 +49,17 @@
 import org.onap.dmaap.datarouter.provisioning.FeedServlet;
 
 public class IntegrationTestBase {
-    /** The properties file to read the DB properties from. */
-    public static final String CONFIG_FILE = "integration_test.properties";
+
+    /**
+     * The properties file to read the DB properties from.
+     */
+    private static final String CONFIG_FILE = "integration_test.properties";
 
     public Properties props;
     protected AbstractHttpClient httpclient;
-    protected String s33;
-    protected String s257;
-    protected static JSONObject db_state;
+    String s33;
+    String s257;
+    static JSONObject db_state;
 
     /**
      * This is the setUp method.
@@ -65,13 +68,10 @@
     public void setUp() throws Exception {
         if (props == null) {
             props = new Properties();
-            InputStream inStream = getClass().getClassLoader().getResourceAsStream(CONFIG_FILE);
-            try {
+            try (InputStream inStream = getClass().getClassLoader().getResourceAsStream(CONFIG_FILE)) {
                 props.load(inStream);
             } catch (Exception e) {
                 e.printStackTrace();
-            } finally {
-                inStream.close();
             }
         }
 
@@ -83,8 +83,8 @@
 
         // keystore
         String store = props.getProperty("test.keystore");
-        String pass  = props.getProperty("test.kspassword");
-        KeyStore keyStore  = KeyStore.getInstance(KeyStore.getDefaultType());
+        String pass = props.getProperty("test.kspassword");
+        KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
         FileInputStream instream = new FileInputStream(new File(store));
         try {
             keyStore.load(instream, pass.toCharArray());
@@ -99,8 +99,8 @@
         }
 
         store = props.getProperty("test.truststore");
-        pass  = props.getProperty("test.tspassword");
-        KeyStore trustStore  = KeyStore.getInstance(KeyStore.getDefaultType());
+        pass = props.getProperty("test.tspassword");
+        KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
         instream = new FileInputStream(new File(store));
         try {
             trustStore.load(instream, pass.toCharArray());
@@ -117,15 +117,17 @@
         SSLSocketFactory socketFactory = new SSLSocketFactory(keyStore, "changeit", trustStore);
         Scheme sch = new Scheme("https", 443, socketFactory);
         httpclient.getConnectionManager().getSchemeRegistry().register(sch);
+
+        //DbTestData.populateDb(httpclient, props);
     }
 
     /**
      * This is the getDBstate method.
      */
-    public JSONObject getDBstate() {
+    void getDBstate() {
         // set db_state!
         if (db_state == null) {
-            String url   = props.getProperty("test.host") + "/internal/prov";
+            String url = props.getProperty("test.host") + "/internal/prov";
             HttpGet httpGet = new HttpGet(url);
             try {
                 httpGet.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
@@ -133,7 +135,7 @@
                 HttpEntity entity = response.getEntity();
                 String ctype = entity.getContentType().getValue().trim();
                 // save the response body as db_state
-                boolean ok  = ctype.equals(FeedServlet.PROVFULL_CONTENT_TYPE1);
+                boolean ok = ctype.equals(FeedServlet.PROVFULL_CONTENT_TYPE1);
                 ok |= ctype.equals(FeedServlet.PROVFULL_CONTENT_TYPE2);
                 if (ok) {
                     db_state = null;
@@ -151,7 +153,6 @@
                 httpGet.releaseConnection();
             }
         }
-        return db_state;
     }
 
     /**
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/BaseServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/BaseServletTest.java
index 5966b77..99142ac 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/BaseServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/BaseServletTest.java
@@ -29,11 +29,14 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
+import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.dmaap.datarouter.provisioning.utils.DB;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.HashSet;
+import java.util.Properties;
 import java.util.Set;
 
 import static org.hamcrest.Matchers.is;
@@ -44,6 +47,7 @@
 
 @RunWith(MockitoJUnitRunner.class)
 public class BaseServletTest {
+
     private BaseServlet baseServlet;
 
     @Mock
@@ -51,20 +55,25 @@
 
     @Before
     public void setUp() throws Exception {
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "startmsg_flag", false, true);
+        Properties props = new Properties();
+        props.setProperty("org.onap.dmaap.datarouter.provserver.isaddressauthenabled", "false");
+        FieldUtils.writeDeclaredStaticField(DB.class, "props", props, true);
+        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "startmsgFlag", false, true);
         SynchronizerTask synchronizerTask = mock(SynchronizerTask.class);
+        when(synchronizerTask.getState()).thenReturn(SynchronizerTask.UNKNOWN);
         FieldUtils.writeDeclaredStaticField(BaseServlet.class, "synctask", synchronizerTask, true);
         baseServlet = new BaseServlet();
     }
 
 
     @Test
-    public void Given_Request_Path_Info_Is_Valid_Then_Id_Is_Extracted_Correctly() throws Exception {
+    public void Given_Request_Path_Info_Is_Valid_Then_Id_Is_Extracted_Correctly() {
         when(request.getPathInfo()).thenReturn("/123");
         assertThat(baseServlet.getIdFromPath(request), is(123));
     }
+
     @Test
-    public void Given_Request_Path_Info_Is_Not_Valid_Then_Minus_One_Is_Returned() throws Exception {
+    public void Given_Request_Path_Info_Is_Not_Valid_Then_Minus_One_Is_Returned() {
         when(request.getPathInfo()).thenReturn("/abc");
         assertThat(baseServlet.getIdFromPath(request), is(-1));
         when(request.getPathInfo()).thenReturn("/");
@@ -76,8 +85,10 @@
         when(request.isSecure()).thenReturn(true);
         Set<String> authAddressesAndNetworks = new HashSet<String>();
         authAddressesAndNetworks.add(("127.0.0.1"));
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "authorizedAddressesAndNetworks", authAddressesAndNetworks, true);
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "require_cert", false, true);
+        FieldUtils
+            .writeDeclaredStaticField(BaseServlet.class, "authorizedAddressesAndNetworks", authAddressesAndNetworks,
+                true);
+        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "requireCert", false, true);
         assertThat(baseServlet.isAuthorizedForProvisioning(request), is(nullValue()));
     }
 }
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java
index 0e717b3..858a71c 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java
@@ -23,7 +23,6 @@
 package org.onap.dmaap.datarouter.provisioning;
 
 import org.apache.commons.lang3.reflect.FieldUtils;
-import org.apache.log4j.Logger;
 import org.json.JSONObject;
 import org.junit.Before;
 import org.junit.Test;
@@ -33,6 +32,7 @@
 import org.onap.dmaap.datarouter.authz.Authorizer;
 import org.onap.dmaap.datarouter.provisioning.beans.Feed;
 import org.onap.dmaap.datarouter.provisioning.beans.Updateable;
+import org.onap.dmaap.datarouter.provisioning.utils.DB;
 import org.powermock.api.mockito.PowerMockito;
 import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
 import org.powermock.modules.junit4.PowerMockRunner;
@@ -41,8 +41,8 @@
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.io.OutputStream;
 import java.util.HashSet;
+import java.util.Properties;
 import java.util.Set;
 
 import static org.hamcrest.Matchers.notNullValue;
@@ -53,6 +53,7 @@
 @RunWith(PowerMockRunner.class)
 @SuppressStaticInitializationFor("org.onap.dmaap.datarouter.provisioning.beans.Feed")
 public class FeedServletTest {
+
     private static FeedServlet feedServlet;
 
     @Mock
@@ -71,7 +72,8 @@
     }
 
     @Test
-    public void Given_Request_Is_HTTP_DELETE_And_Is_Not_Secure_When_HTTPS_Is_Required_Then_Forbidden_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_DELETE_And_Is_Not_Secure_When_HTTPS_Is_Required_Then_Forbidden_Response_Is_Generated()
+        throws Exception {
         when(request.isSecure()).thenReturn(false);
         feedServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
@@ -79,7 +81,8 @@
 
 
     @Test
-    public void Given_Request_Is_HTTP_DELETE_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_DELETE_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated()
+        throws Exception {
         setBehalfHeader(null);
         feedServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
@@ -87,7 +90,8 @@
 
 
     @Test
-    public void Given_Request_Is_HTTP_DELETE_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_DELETE_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated()
+        throws Exception {
         when(request.getPathInfo()).thenReturn(null);
         feedServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
@@ -95,7 +99,8 @@
 
 
     @Test
-    public void Given_Request_Is_HTTP_DELETE_And_Feed_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_DELETE_And_Feed_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated()
+        throws Exception {
         setFeedToReturnInvalidFeedIdSupplied();
         feedServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
@@ -103,7 +108,8 @@
 
 
     @Test
-    public void Given_Request_Is_HTTP_DELETE_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_DELETE_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated()
+        throws Exception {
         setAuthoriserToReturnRequestNotAuthorized();
         feedServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
@@ -111,19 +117,22 @@
 
 
     @Test
-    public void Given_Request_Is_HTTP_DELETE_And_Delete_On_Database_Fails_An_Internal_Server_Error_Is_Reported() throws Exception {
+    public void Given_Request_Is_HTTP_DELETE_And_Delete_On_Database_Fails_An_Internal_Server_Error_Is_Reported()
+        throws Exception {
         FeedServlet feedServlet = new FeedServlet() {
             protected boolean doUpdate(Updateable bean) {
                 return false;
             }
         };
         feedServlet.doDelete(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
+        verify(response)
+            .sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
     }
 
 
     @Test
-    public void Given_Request_Is_HTTP_DELETE_And_Delete_On_Database_Succeeds_A_NO_CONTENT_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_DELETE_And_Delete_On_Database_Succeeds_A_NO_CONTENT_Response_Is_Generated()
+        throws Exception {
         FeedServlet feedServlet = new FeedServlet() {
             protected boolean doUpdate(Updateable bean) {
                 return true;
@@ -134,14 +143,16 @@
     }
 
     @Test
-    public void Given_Request_Is_HTTP_GET_And_Is_Not_Secure_When_HTTPS_Is_Required_Then_Forbidden_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_GET_And_Is_Not_Secure_When_HTTPS_Is_Required_Then_Forbidden_Response_Is_Generated()
+        throws Exception {
         when(request.isSecure()).thenReturn(false);
         feedServlet.doGet(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
     }
 
     @Test
-    public void Given_Request_Is_HTTP_GET_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_GET_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated()
+        throws Exception {
         setBehalfHeader(null);
         feedServlet.doGet(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
@@ -149,7 +160,8 @@
 
 
     @Test
-    public void Given_Request_Is_HTTP_GET_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_GET_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated()
+        throws Exception {
         when(request.getPathInfo()).thenReturn(null);
         feedServlet.doGet(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
@@ -157,7 +169,8 @@
 
 
     @Test
-    public void Given_Request_Is_HTTP_GET_And_Feed_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_GET_And_Feed_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated()
+        throws Exception {
         setFeedToReturnInvalidFeedIdSupplied();
         feedServlet.doGet(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
@@ -165,7 +178,8 @@
 
 
     @Test
-    public void Given_Request_Is_HTTP_GET_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_GET_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated()
+        throws Exception {
         setAuthoriserToReturnRequestNotAuthorized();
         feedServlet.doGet(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
@@ -182,14 +196,16 @@
 
 
     @Test
-    public void Given_Request_Is_HTTP_PUT_And_Is_Not_Secure_When_HTTPS_Is_Required_Then_Forbidden_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_PUT_And_Is_Not_Secure_When_HTTPS_Is_Required_Then_Forbidden_Response_Is_Generated()
+        throws Exception {
         when(request.isSecure()).thenReturn(false);
         feedServlet.doPut(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
     }
 
     @Test
-    public void Given_Request_Is_HTTP_PUT_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_PUT_And_BEHALF_HEADER_Is_Not_Set_In_Request_Then_Bad_Request_Response_Is_Generated()
+        throws Exception {
         setBehalfHeader(null);
         feedServlet.doPut(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
@@ -197,7 +213,8 @@
 
 
     @Test
-    public void Given_Request_Is_HTTP_PUT_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_PUT_And_Path_Header_Is_Not_Set_In_Request_With_Valid_Path_Then_Bad_Request_Response_Is_Generated()
+        throws Exception {
         when(request.getPathInfo()).thenReturn(null);
         feedServlet.doPut(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
@@ -205,21 +222,25 @@
 
 
     @Test
-    public void Given_Request_Is_HTTP_PUT_And_Feed_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_PUT_And_Feed_Id_Is_Invalid_Then_Not_Found_Response_Is_Generated()
+        throws Exception {
         setFeedToReturnInvalidFeedIdSupplied();
         feedServlet.doPut(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
     }
 
     @Test
-    public void Given_Request_Is_HTTP_PUT_And_Content_Header_Is_Not_Supported_Type_Then_Unsupported_Media_Type_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_PUT_And_Content_Header_Is_Not_Supported_Type_Then_Unsupported_Media_Type_Response_Is_Generated()
+        throws Exception {
         when(request.getContentType()).thenReturn("stub_contentType");
         feedServlet.doPut(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), argThat(notNullValue(String.class)));
+        verify(response)
+            .sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), argThat(notNullValue(String.class)));
     }
 
     @Test
-    public void Given_Request_Is_HTTP_PUT_And_Request_Contains_Badly_Formed_JSON_Then_Bad_Request_Response_Is_Generated() throws Exception {
+    public void Given_Request_Is_HTTP_PUT_And_Request_Contains_Badly_Formed_JSON_Then_Bad_Request_Response_Is_Generated()
+        throws Exception {
         when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.feed; version=1.0");
         ServletInputStream inStream = mock(ServletInputStream.class);
         when(request.getInputStream()).thenReturn(inStream);
@@ -228,8 +249,12 @@
     }
 
 
-    private void initialiseBaseServletToBypassRetreiviingInitialisationParametersFromDatabase() throws IllegalAccessException {
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "startmsg_flag", false, true);
+    private void initialiseBaseServletToBypassRetreiviingInitialisationParametersFromDatabase()
+        throws IllegalAccessException {
+        Properties props = new Properties();
+        props.setProperty("org.onap.dmaap.datarouter.provserver.isaddressauthenabled", "false");
+        FieldUtils.writeDeclaredStaticField(DB.class, "props", props, true);
+        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "startmsgFlag", false, true);
         SynchronizerTask synchronizerTask = mock(SynchronizerTask.class);
         when(synchronizerTask.getState()).thenReturn(SynchronizerTask.UNKNOWN);
         FieldUtils.writeDeclaredStaticField(SynchronizerTask.class, "synctask", synchronizerTask, true);
@@ -239,8 +264,10 @@
         when(request.isSecure()).thenReturn(true);
         Set<String> authAddressesAndNetworks = new HashSet<String>();
         authAddressesAndNetworks.add(("127.0.0.1"));
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "authorizedAddressesAndNetworks", authAddressesAndNetworks, true);
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "require_cert", false, true);
+        FieldUtils
+            .writeDeclaredStaticField(BaseServlet.class, "authorizedAddressesAndNetworks", authAddressesAndNetworks,
+                true);
+        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "requireCert", false, true);
     }
 
     private void setBehalfHeader(String headerValue) {
@@ -282,7 +309,7 @@
 
     private void setPokerToNotCreateTimersWhenDeleteFeedIsCalled() throws Exception {
         Poker poker = mock(Poker.class);
-        FieldUtils.writeDeclaredStaticField(Poker.class, "p", poker, true);
+        FieldUtils.writeDeclaredStaticField(Poker.class, "poker", poker, true);
     }
 
     private void setupValidAuthorisedRequest() throws Exception {
