Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenApiWordServiceImpl 类代码有两处异常链丢失,可以改进 #64

Open
nfc916 opened this issue Dec 3, 2021 · 0 comments
Open

Comments

@nfc916
Copy link

nfc916 commented Dec 3, 2021

使用2.9.2版本默认设置时,有两处空指针异常处理不到位:
一: OpenApiWordServiceImpl 类下的processResponseCodeList 方法 :
String ref = String.valueOf(statusCodeInfo.get("$ref"));
if (ref != "") {
ModelAttr modelAttr = definitinMap.get(ref);
// 问题: 此处未判断 modelAttr为空的情况,使用过程中因异常链接丢失,定位比较困难
response.setDescription(modelAttr.getDescription());
}
responseList.add(response);

二:OpenApiWordServiceImpl 类下的processRequestList方法 :
request.setName(String.valueOf(param.get("name")));
Map<String, String> schema1 = (Map) param.get("schema");
// 此处代码也未考虑schema1.get("type")为空的问题,直接toString()引用,同样异常链丢失。 前面已经声明泛型,不需要toString()
request.setType(schema1 == null ? " " : schema1.get("type").toString());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant