fix null point error, while dictionary is null.

This commit is contained in:
oppofind 2020-08-08 22:34:11 +08:00
parent ed30182872
commit 67ea4d1b94
2 changed files with 6 additions and 1 deletions

View File

@ -27,6 +27,7 @@ import com.power.doc.constants.DocLanguage;
import com.power.doc.model.rpc.RpcApiDependency;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@ -223,6 +224,7 @@ public class ApiConfig {
/**
* custom setting api document name
*
* @since 1.9.0
*/
private String allInOneDocFileName;
@ -345,6 +347,9 @@ public class ApiConfig {
}
public ApiDataDictionary getDataDictionary(String enumClassSimpleName) {
if (Objects.isNull(this.dataDictionaries)) {
return null;
}
return this.dataDictionaries.stream().filter((apiDataDictionary ->
enumClassSimpleName.equalsIgnoreCase(apiDataDictionary.getEnumClassName())))
.findFirst().orElse(new ApiDataDictionary());

View File

@ -531,7 +531,7 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
String[] gicNameArr = DocClassUtil.getSimpleGicName(typeName);
paramList.addAll(ParamsBuildHelper.buildParams(gicNameArr[1], DocGlobalConstants.EMPTY, 0, "true", responseFieldMap, Boolean.FALSE, new HashMap<>(), builder, groupClasses, 0));
}
//参数列表 当为枚举时
// param is enum
else if (javaClass.isEnum()) {
String o = JavaClassUtil.getEnumParams(javaClass);