Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1116,17 +1116,21 @@ protected Type findJsonValueType(final BeanDescription beanDesc) {

// use recursion to check for method findJsonValueAccessor existence (Jackson 2.9+)
// if not found use previous deprecated method which could lead to inaccurate result
AnnotatedMember jsonValueMember = invokeMethod(beanDesc, "findJsonValueAccessor");
if (jsonValueMember != null) {
return jsonValueMember.getType();
} else {
try {
AnnotatedMember jsonValueMember = invokeMethod(beanDesc, "findJsonValueAccessor");
if (jsonValueMember != null) {
return jsonValueMember.getType();
}
} catch (Exception e) {
LOGGER.warn("jackson BeanDescription.findJsonValueAccessor not found, this could lead to inaccurate result, please update jackson to 2.9+");
}

jsonValueMember = invokeMethod(beanDesc, "findJsonValueMethod");
if (jsonValueMember != null) {
return jsonValueMember.getType();
} else {
try {
AnnotatedMember jsonValueMember = invokeMethod(beanDesc, "findJsonValueMethod");
if (jsonValueMember != null) {
return jsonValueMember.getType();
}
} catch (Exception e) {
LOGGER.error("Neither 'findJsonValueMethod' nor 'findJsonValueAccessor' found in jackson BeanDescription. Please verify your Jackson version.");
}
return null;
Expand Down Expand Up @@ -3057,13 +3061,9 @@ protected boolean isNumberSchema(Schema schema){
return "number".equals(schema.getType()) || (schema.getTypes() != null && schema.getTypes().contains("number")) || "integer".equals(schema.getType()) || (schema.getTypes() != null && schema.getTypes().contains("integer"));
}

private AnnotatedMember invokeMethod(final BeanDescription beanDesc, String methodName) {
try {
Method m = BeanDescription.class.getMethod(methodName);
return (AnnotatedMember) m.invoke(beanDesc);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
return null;
}
private AnnotatedMember invokeMethod(final BeanDescription beanDesc, String methodName) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException{
Method m = BeanDescription.class.getMethod(methodName);
return (AnnotatedMember) m.invoke(beanDesc);
}

protected Schema buildRefSchemaIfObject(Schema schema, ModelConverterContext context) {
Expand Down
Loading