diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java index 44dd0da3de..c7b66b1a26 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java @@ -9,7 +9,6 @@ import com.aliyuncs.http.FormatType; import com.aliyuncs.http.HttpResponse; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.ConvertUtils; -import com.aliyuncs.http.MethodType; import com.epmet.commons.tools.utils.Result; import com.epmet.openapi.scan.common.constant.SysConstant; import com.epmet.openapi.scan.common.enu.*; @@ -33,6 +32,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -205,12 +205,12 @@ public class ScanServiceImpl implements ScanService { } return result; } else { - log.warn("executeSyncText response not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + log.error("executeSyncText response not success. response:{}", JSON.toJSONString(scrResponse)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg()); } } else { - log.warn("executeSyncText response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + log.error("executeSyncText response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg()); } } catch (Exception e) { log.error("executeSyncText exception IAcsClientUtil do action exception", e); @@ -223,7 +223,7 @@ public class ScanServiceImpl implements ScanService { try { HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(request); if (httpResponse.isSuccess()) { - JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), SysConstant.UTF8)); + JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), StandardCharsets.UTF_8)); if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { JSONArray taskResults = scrResponse.getJSONArray(SysConstant.DATA); List scanTaskResults = taskResults.toJavaList(ScanTaskResult.class); @@ -256,12 +256,12 @@ public class ScanServiceImpl implements ScanService { } return result; } else { - log.warn("executeSyncImg detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + log.error("executeSyncImg detect not success. response:{}", JSON.toJSONString(scrResponse)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg()); } } else { - log.warn("executeSyncImg response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); - throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + log.error("executeSyncImg response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg()); } } catch (Exception e) { log.error("executeSyncImg exception IAcsClientUtil do action exception", e);