aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsaac Manuel Raj <isaac.manuelraj@huawei.com>2019-08-09 19:17:32 +0530
committerIsaac Manuel Raj <isaac.manuelraj@huawei.com>2019-08-09 19:17:32 +0530
commit8b458c84e7b09e3717623d8039f4d732e43148d1 (patch)
tree8e4543f4d8dab77bfaf0ef107f32f15e1e79f1d8
parent0ca2b4ccdcdd3c7801ecb4a2fb12cfe31b936f9b (diff)
Usecaseui server sonar critical issue fix.
Usecase ui code was not having logger to capture the exception trace. The same is fixed. Issue-ID: USECASEUI-304 Signed-off-by: Isaac Manuel Raj <isaac.manuelraj@huawei.com> Change-Id: I25ca93ba415c9bc30b3572f584e1fe9a09a53bf0
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java7
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java3
2 files changed, 6 insertions, 4 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java b/server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java
index 9ac0afc8..07514660 100644
--- a/server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java
+++ b/server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java
@@ -24,6 +24,7 @@ import java.net.URLConnection;
import java.util.List;
import java.util.Map;
+import com.google.common.base.Throwables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -73,7 +74,7 @@ public class HttpUtil {
}
} catch (Exception e) {
logger.error("发送GET请求出现异常!" + e);
- e.printStackTrace();
+ logger.error("发送GET请求出现异常!" + Throwables.getStackTraceAsString(e));
}
// 使用finally块来关闭输入流
finally {
@@ -82,7 +83,7 @@ public class HttpUtil {
in.close();
}
} catch (Exception e2) {
- e2.printStackTrace();
+ logger.error("Exception occured while closing the connection {}" + Throwables.getStackTraceAsString(e2));
}
}
return result;
@@ -128,7 +129,7 @@ public class HttpUtil {
}
} catch (Exception e) {
logger.error("发送 POST 请求出现异常!"+e);
- e.printStackTrace();
+ logger.error("发送 POST 请求出现异常!"+Throwables.getStackTraceAsString(e));
}
//使用finally块来关闭输出流、输入流
finally{
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java b/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java
index 5c8a13f2..837abee9 100644
--- a/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java
+++ b/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java
@@ -27,6 +27,7 @@ import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
+import com.google.common.base.Throwables;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -113,7 +114,7 @@ public class UuiCommonUtil {
}
} catch (IOException e) {
logger.error("exception occurred while performing UuiCommonUtil OutRequestBody.Details:"+ e.getMessage());
- e.printStackTrace();
+ logger.error("exception occurred while performing UuiCommonUtil OutRequestBody.Details:"+ Throwables.getStackTraceAsString(e));
}
return wholeStr;
}