From 7f83dbe5b0266c466fcbd929a1168617434fa8db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E6=9D=A5=E5=AE=BE?= Date: Wed, 17 Jun 2020 10:00:16 +0800 Subject: [PATCH] =?UTF-8?q?bugfix-NPE=E5=BC=82=E5=B8=B8=20=E4=BE=8B?= =?UTF-8?q?=E5=A6=82=EF=BC=9A=E5=BD=93=20ref=20=3D=20ApiResult=C2=ABVoid?= =?UTF-8?q?=C2=BB=20=E6=97=B6=EF=BC=8C=20definitions=E7=9A=84=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E5=A6=82=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "definitions": { "ApiResult«Void»": { "type": "object", "title": "ApiResult«Void»" } } --- .../gitee/sop/websiteserver/manager/SwaggerDocParser.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sop-website/src/main/java/com/gitee/sop/websiteserver/manager/SwaggerDocParser.java b/sop-website/src/main/java/com/gitee/sop/websiteserver/manager/SwaggerDocParser.java index c7e366d2..f47e3c21 100644 --- a/sop-website/src/main/java/com/gitee/sop/websiteserver/manager/SwaggerDocParser.java +++ b/sop-website/src/main/java/com/gitee/sop/websiteserver/manager/SwaggerDocParser.java @@ -208,8 +208,11 @@ public class SwaggerDocParser implements DocParser { protected List buildDocParameters(String ref, JSONObject docRoot, boolean doSubRef) { JSONObject responseObject = docRoot.getJSONObject("definitions").getJSONObject(ref); JSONObject properties = responseObject.getJSONObject("properties"); - Set fieldNames = properties.keySet(); List docParameterList = new ArrayList<>(); + if (properties == null) { + return docParameterList; + } + Set fieldNames = properties.keySet(); for (String fieldName : fieldNames) { /* {