【fix sonar】RestDesformUtil文件

This commit is contained in:
梁琦涛
2023-03-06 10:38:55 +08:00
parent 3f3814699c
commit 40f25b8d46
@@ -7,6 +7,8 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import java.util.Objects;
/** /**
* 通过 RESTful 风格的接口操纵 desform 里的数据 * 通过 RESTful 风格的接口操纵 desform 里的数据
* *
@@ -14,6 +16,10 @@ import org.springframework.http.ResponseEntity;
*/ */
public class RestDesformUtil { public class RestDesformUtil {
private RestDesformUtil(){
}
private static String domain = null; private static String domain = null;
private static String path = null; private static String path = null;
@@ -84,8 +90,9 @@ public class RestDesformUtil {
} }
private static Result packageReturn(ResponseEntity<JSONObject> result) { private static Result packageReturn(ResponseEntity<JSONObject> result) {
if (result.getBody() != null) { JSONObject json = result.getBody();
return result.getBody().toJavaObject(Result.class); if (!Objects.isNull(json)) {
return json.toJavaObject(Result.class);
} }
return Result.error("操作失败"); return Result.error("操作失败");
} }
@@ -118,4 +125,4 @@ public class RestDesformUtil {
return headers; return headers;
} }
} }