fix null point error

This commit is contained in:
oppofind 2020-10-24 13:45:53 +08:00
parent 1a9a64eb03
commit 50cfffc80e
1 changed files with 145 additions and 144 deletions

View File

@ -23,14 +23,15 @@
package com.power.doc.handler;
import com.power.common.util.StringUtil;
import com.power.doc.constants.*;
import com.power.doc.constants.DocAnnotationConstants;
import com.power.doc.constants.DocTags;
import com.power.doc.constants.SpringMvcAnnotations;
import com.power.doc.model.ApiReqHeader;
import com.power.doc.utils.DocClassUtil;
import com.power.doc.utils.DocUtil;
import com.thoughtworks.qdox.model.JavaAnnotation;
import com.thoughtworks.qdox.model.JavaMethod;
import com.thoughtworks.qdox.model.JavaParameter;
import com.thoughtworks.qdox.model.expression.AnnotationValue;
import java.util.*;
import java.util.stream.Collectors;
@ -51,11 +52,11 @@ public class SpringMVCRequestHeaderHandler {
List<ApiReqHeader> mappingHeaders = new ArrayList<>();
List<JavaAnnotation> annotations = method.getAnnotations();
for (JavaAnnotation annotation : annotations) {
String annotationName = annotation.getType().getName();
if (!isMapping(annotationName)) {
String annotationName = annotation.getType().getValue();
Object headersObject = annotation.getNamedParameter("headers");
if (!isMapping(annotationName) || Objects.isNull(headersObject)) {
continue;
}
Object headersObject = annotation.getNamedParameter("headers");
List<String> headers = (LinkedList) headersObject;
for (String str : headers) {
String header = StringUtil.removeQuotes(str);