You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/06/01 01:08:26 UTC

[GitHub] [incubator-shenyu] lianjunwei commented on a diff in pull request #3447: NPE repair of admin module caused by spring MVC example synchronization

lianjunwei commented on code in PR #3447:
URL: https://github.com/apache/incubator-shenyu/pull/3447#discussion_r886241753


##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/SwaggerDocParser.java:
##########
@@ -56,7 +56,7 @@ public class SwaggerDocParser implements DocParser {
     @Override
     public DocInfo parseJson(final JSONObject docRoot) {
         final String basePath = docRoot.getString("basePath");
-        final String title = docRoot.getJSONObject("info").getString("title");
+        final String title = Optional.ofNullable(docRoot.getJSONObject("info")).map(jsonObject -> jsonObject.getString("title")).orElse("");

Review Comment:
   > 1. Docroot.getjsonobject (" info ") is null, unable to get the title of the document. It is recommended that contextpath (that is, the value of the "basepath" variable in the previous line) be the default title of the document, because it can ensure the uniqueness of the title.
      2. Line 168 of the swaggerdocparser class file will also be null, which is handled as above.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org