From c3813f47e8b3a93936df973c9105f2bc796ba90b Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 21 Apr 2021 10:50:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=AE=A1=E6=A0=B8=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scan/service/impl/ScanServiceImpl.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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);