INT-3585: JsonPropertyAccessor: skip failed parse
JIRA: https://jira.spring.io/browse/INT-3585 Even if this fix doesn't provide an order support, it does cover an original premise of an issue With this fix the order of accessors doesn't matter. * Catch an `AccessException` in the `JsonPropertyAccessor.canRead()` and return `false` to let the rest accessors to deal with the property requested
This commit is contained in:
committed by
Gary Russell
parent
eef31d4b34
commit
51b6ba8de8
@@ -70,7 +70,14 @@ public class JsonPropertyAccessor implements PropertyAccessor {
|
||||
|
||||
@Override
|
||||
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
JsonNode node = asJson(target);
|
||||
JsonNode node;
|
||||
try {
|
||||
node = asJson(target);
|
||||
}
|
||||
catch (AccessException e) {
|
||||
// Cannot parse - treat as not a JSON
|
||||
return false;
|
||||
}
|
||||
Integer index = maybeIndex(name);
|
||||
if (node instanceof ArrayNode) {
|
||||
return index != null;
|
||||
|
||||
Reference in New Issue
Block a user