Skip to content

Commit 18f5123

Browse files
authored
Update JavadocPropertyCustomizer.java
A NPE exception occurs when a property does not have a getter method
1 parent a714f41 commit 18f5123

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/JavadocPropertyCustomizer.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,11 @@ public void setJavadocDescription(Class<?> cls, List<Field> fields, List<Propert
166166
if (StringUtils.isBlank(stringSchemaEntry.getValue().getDescription())) {
167167
Optional<PropertyDescriptor> optionalPd = clsProperties.stream().filter(pd -> pd.getName().equals(stringSchemaEntry.getKey())).findAny();
168168
optionalPd.ifPresent(pd1 -> {
169-
String fieldJavadoc = javadocProvider.getMethodJavadocDescription(pd1.getReadMethod());
170-
if (StringUtils.isNotBlank(fieldJavadoc))
171-
stringSchemaEntry.getValue().setDescription(fieldJavadoc);
169+
if(pd1.getReadMethod() != null) {
170+
String fieldJavadoc = javadocProvider.getMethodJavadocDescription(pd1.getReadMethod());
171+
if (StringUtils.isNotBlank(fieldJavadoc))
172+
stringSchemaEntry.getValue().setDescription(fieldJavadoc);
173+
}
172174
});
173175
}
174176
});

0 commit comments

Comments
 (0)