summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxu ran <xuranyjy@chinamobile.com>2020-03-11 12:54:34 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-11 12:54:34 +0000
commite6b71e07b7893b71c2b0dff19844c5f3630614e6 (patch)
tree9f58bc1792a9d17ad575e38934feaa019374a3f0
parent5659ae42906a8043eb10e7bfab3babb59a3a19d7 (diff)
parentcba627d9a1bf9080e2781e440e19c3615b5ae10e (diff)
Merge "General sonar fixes"
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImpl.java10
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/SlicServiceInstanceService.java6
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/nsmf/NsmfCommonUtil.java4
3 files changed, 7 insertions, 13 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImpl.java
index 18cd7175..bebab943 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceImpl.java
@@ -84,7 +84,7 @@ public class ResourceMonitorServiceImpl implements ResourceMonitorService {
String strKpiHours = p.getProperty("slicing.kpi.hours");
this.kpiHours = Integer.parseInt(strKpiHours);
} catch (IOException e1) {
- logger.error("get configuration file arise error :{}", e1.getMessage());
+ logger.error("get configuration file arise error :{}", e1);
}
}
@@ -99,7 +99,6 @@ public class ResourceMonitorServiceImpl implements ResourceMonitorService {
String resultMsg = "";
try {
- // TODO
for (ServiceInfo serviceInfo : serviceInfoList) {
String newTimestamp = NsmfCommonUtil.time2Timestamp(queryTimestamp)
.replace(NsmfParamConstant.SPACE, "T");
@@ -129,7 +128,7 @@ public class ResourceMonitorServiceImpl implements ResourceMonitorService {
} catch (Exception e) {
resultMsg = "5G slicing usage traffic query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in querySlicingUsageTraffic :{}",e);
}
usageTrafficList.setUsageTrafficInfoList(usageTrafficInfoList);
logger.info(resultMsg);
@@ -151,7 +150,6 @@ public class ResourceMonitorServiceImpl implements ResourceMonitorService {
String resultMsg = "";
try {
- // TODO
for (ServiceInfo serviceInfo : serviceInfoList) {
String newTimestamp = NsmfCommonUtil.time2Timestamp(queryTimestamp)
.replace(NsmfParamConstant.SPACE, "T");
@@ -182,7 +180,7 @@ public class ResourceMonitorServiceImpl implements ResourceMonitorService {
} catch (Exception e) {
resultMsg = "5G slicing online users query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in querySlicingOnlineUserNumber :{}",e);
}
logger.info(resultMsg);
@@ -237,7 +235,7 @@ public class ResourceMonitorServiceImpl implements ResourceMonitorService {
} catch (Exception e) {
resultMsg = "5G slicing total bandwidth query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in querySlicingTotalBandwidth :{}",e);
}
logger.info(resultMsg);
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/SlicServiceInstanceService.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/SlicServiceInstanceService.java
index fa5977e2..4ccc1430 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/SlicServiceInstanceService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/SlicServiceInstanceService.java
@@ -16,14 +16,10 @@
package org.onap.usecaseui.server.service.slicingdomain;
+import java.util.List;
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceInstance;
-
import com.alibaba.fastjson.JSONObject;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-
public interface SlicServiceInstanceService {
List<AAIServiceInstance> listService();
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/nsmf/NsmfCommonUtil.java b/server/src/main/java/org/onap/usecaseui/server/util/nsmf/NsmfCommonUtil.java
index 4a7c5b2b..b7669992 100644
--- a/server/src/main/java/org/onap/usecaseui/server/util/nsmf/NsmfCommonUtil.java
+++ b/server/src/main/java/org/onap/usecaseui/server/util/nsmf/NsmfCommonUtil.java
@@ -37,14 +37,14 @@ public class NsmfCommonUtil {
public static String time2Timestamp(String time) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(NsmfParamConstant.DATE_FORMAT);
- long longTime = new Long(time);
+ long longTime = Long.parseLong(time);
Date date = new Date(longTime);
return simpleDateFormat.format(date);
}
public static <T> PagedResult getPagedList(List<T> list, int pageNo, int pageSize) {
if (list == null || pageNo < 1 || (pageNo - 1) * pageSize > list.size()) {
- return new PagedResult(0, Collections.EMPTY_LIST);
+ return new PagedResult(0, Collections.emptyList());
}
list = list.stream().skip((pageNo - 1) * (long)pageSize).limit(pageSize).collect(Collectors.toList());
return new PagedResult(list.size(), list );