From 8f7fa9917626095a816dc2114a5c1e99a89ea11b Mon Sep 17 00:00:00 2001 From: johnmarquez12 <42983443+johnmarquez12@users.noreply.github.com> Date: Fri, 8 Apr 2022 00:03:30 -0700 Subject: [PATCH] Fixed NullpointerException when getting methodtree (#5024) Co-authored-by: jm041977 --- .../org/glassfish/jersey/wadl/doclet/ResourceDoclet.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/wadl-doclet/src/main/java12/org/glassfish/jersey/wadl/doclet/ResourceDoclet.java b/ext/wadl-doclet/src/main/java12/org/glassfish/jersey/wadl/doclet/ResourceDoclet.java index 944413f53b..ff94b7595b 100644 --- a/ext/wadl-doclet/src/main/java12/org/glassfish/jersey/wadl/doclet/ResourceDoclet.java +++ b/ext/wadl-doclet/src/main/java12/org/glassfish/jersey/wadl/doclet/ResourceDoclet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -162,8 +162,10 @@ public boolean run(DocletEnvironment docEnv) { Map> tags = getTags(docTrees.getDocCommentTree(method)); MethodTree methodTree = docTrees.getTree(method); MethodDocType methodDocType = new MethodDocType(); - methodDocType.setMethodName(methodTree.getName().toString()); - methodDocType.setCommentText(getComments(docTrees.getDocCommentTree(method))); + if (methodTree != null) { + methodDocType.setMethodName(methodTree.getName().toString()); + methodDocType.setCommentText(getComments(docTrees.getDocCommentTree(method))); + } getTags(docTrees.getDocCommentTree(method)); StringBuilder arguments = new StringBuilder("("); Map paramTags = tags.get(DocTree.Kind.PARAM);