Remove unnecessary FieldDoesNotExistException handling

Previously, FieldDoesNotExistException was caught when extracting
a field to determine whether or not it is missing (absent or an
empty collection). The handling is redundant due to an earlier call
to hasField so this commit removes it.

Closes gh-525
This commit is contained in:
Johnny Lim
2018-07-03 18:41:51 +09:00
committed by Andy Wilkinson
parent 02e842dc89
commit 5ace000c75

View File

@@ -84,15 +84,10 @@ class JsonContentHandler implements ContentHandler {
if (!this.fieldProcessor.hasField(candidate.getPath(), payload)) {
return true;
}
try {
ExtractedField extracted = this.fieldProcessor.extract(candidate.getPath(),
payload);
return extracted.getValue() instanceof Collection
&& ((Collection<?>) extracted.getValue()).isEmpty();
}
catch (FieldDoesNotExistException ex) {
return true;
}
ExtractedField extracted = this.fieldProcessor.extract(candidate.getPath(),
payload);
return extracted.getValue() instanceof Collection
&& ((Collection<?>) extracted.getValue()).isEmpty();
}
@Override