diff options
author | Tao Shen <shentao@chinamobile.com> | 2019-08-15 04:20:13 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-08-15 04:20:13 +0000 |
commit | 67cc8f4470f79b737df5044ffcab464600918f36 (patch) | |
tree | 4ab4b4b70d8af6b3bbc778a78a1e7984faa7351f | |
parent | 36894d802879b40bfd547d17e7478d447f64387c (diff) | |
parent | 8b458c84e7b09e3717623d8039f4d732e43148d1 (diff) |
Merge "Usecaseui server sonar critical issue fix."
-rw-r--r-- | server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java | 7 | ||||
-rw-r--r-- | server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java | 3 |
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; } |