修复Optional.of异常问题

1.x
tanghc 6 years ago
parent f9c8a859b7
commit 4e90900561
  1. 6
      sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/DocManagerImpl.java

@ -154,9 +154,9 @@ public class DocManagerImpl implements DocManager {
private String getResponseRef(JSONObject docInfo) {
String ref = Optional.ofNullable(docInfo.getJSONObject("responses"))
.flatMap(jsonObject -> Optional.of(jsonObject.getJSONObject("200")))
.flatMap(jsonObject -> Optional.of(jsonObject.getJSONObject("schema")))
.flatMap(jsonObject -> Optional.of(jsonObject.getString("originalRef")))
.flatMap(jsonObject -> Optional.ofNullable(jsonObject.getJSONObject("200")))
.flatMap(jsonObject -> Optional.ofNullable(jsonObject.getJSONObject("schema")))
.flatMap(jsonObject -> Optional.ofNullable(jsonObject.getString("originalRef")))
.orElse("");
return ref;
}

Loading…
Cancel
Save