Remove critical code smells for utils classes
[dmaap/datarouter.git] / datarouter-prov / src / main / java / org / onap / dmaap / datarouter / provisioning / utils / URLUtilities.java
index b58ab5a..ffed1a1 100644 (file)
@@ -24,6 +24,8 @@
 \r
 package org.onap.dmaap.datarouter.provisioning.utils;\r
 \r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
 import java.net.InetAddress;\r
 import java.net.UnknownHostException;\r
 import java.util.Arrays;\r
@@ -37,7 +39,7 @@ import org.onap.dmaap.datarouter.provisioning.BaseServlet;
  * @version $Id: URLUtilities.java,v 1.2 2014/03/12 19:45:41 eby Exp $\r
  */\r
 public class URLUtilities {\r
-\r
+    private static final EELFLogger utilsLogger = EELFManager.getInstance().getLogger("UtilsLog");\r
     /**\r
      * Generate the URL used to access a feed.\r
      *\r
@@ -45,7 +47,7 @@ public class URLUtilities {
      * @return the URL\r
      */\r
     public static String generateFeedURL(int feedid) {\r
-        return "https://" + BaseServlet.provName + "/feed/" + feedid;\r
+        return "https://" + BaseServlet.getProvName() + "/feed/" + feedid;\r
     }\r
 \r
     /**\r
@@ -55,7 +57,7 @@ public class URLUtilities {
      * @return the URL\r
      */\r
     public static String generatePublishURL(int feedid) {\r
-        return "https://" + BaseServlet.provName + "/publish/" + feedid;\r
+        return "https://" + BaseServlet.getProvName() + "/publish/" + feedid;\r
     }\r
 \r
     /**\r
@@ -65,7 +67,7 @@ public class URLUtilities {
      * @return the URL\r
      */\r
     public static String generateSubscribeURL(int feedid) {\r
-        return "https://" + BaseServlet.provName + "/subscribe/" + feedid;\r
+        return "https://" + BaseServlet.getProvName() + "/subscribe/" + feedid;\r
     }\r
 \r
     /**\r
@@ -75,7 +77,7 @@ public class URLUtilities {
      * @return the URL\r
      */\r
     public static String generateFeedLogURL(int feedid) {\r
-        return "https://" + BaseServlet.provName + "/feedlog/" + feedid;\r
+        return "https://" + BaseServlet.getProvName() + "/feedlog/" + feedid;\r
     }\r
 \r
     /**\r
@@ -85,7 +87,7 @@ public class URLUtilities {
      * @return the URL\r
      */\r
     public static String generateSubscriptionURL(int subid) {\r
-        return "https://" + BaseServlet.provName + "/subs/" + subid;\r
+        return "https://" + BaseServlet.getProvName() + "/subs/" + subid;\r
     }\r
 \r
     /**\r
@@ -95,7 +97,7 @@ public class URLUtilities {
      * @return the URL\r
      */\r
     public static String generateSubLogURL(int subid) {\r
-        return "https://" + BaseServlet.provName + "/sublog/" + subid;\r
+        return "https://" + BaseServlet.getProvName() + "/sublog/" + subid;\r
     }\r
 \r
     /**\r
@@ -115,7 +117,7 @@ public class URLUtilities {
     public static String generatePeerLogsURL() {\r
         //Fixes for Itrack ticket - DATARTR-4#Fixing if only one Prov is configured, not to give exception to fill logs.\r
         String peerPodUrl = getPeerPodName();\r
-        if (peerPodUrl.equals("") || peerPodUrl.equals(null)) {\r
+        if (peerPodUrl == null || peerPodUrl.equals("")) {\r
             return "";\r
         }\r
 \r
@@ -134,6 +136,7 @@ public class URLUtilities {
                 this_pod = InetAddress.getLocalHost().getHostName();\r
                 System.out.println("this_pod: " + this_pod);\r
             } catch (UnknownHostException e) {\r
+                utilsLogger.trace("UnkownHostException: " + e.getMessage(), e);\r
                 this_pod = "";\r
             }\r
             System.out.println("ALL PODS: " + Arrays.asList(BaseServlet.getPods()));\r