Skip to content

Commit b890bb5

Browse files
committed
Make optimizedText work with wrapped parsers
1 parent 89ad24f commit b890bb5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/JsonXContentParser.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import com.fasterxml.jackson.core.JsonProcessingException;
1616
import com.fasterxml.jackson.core.JsonToken;
1717
import com.fasterxml.jackson.core.exc.InputCoercionException;
18+
import com.fasterxml.jackson.core.filter.FilteringParserDelegate;
1819
import com.fasterxml.jackson.core.io.JsonEOFException;
1920

2021
import org.elasticsearch.core.IOUtils;
@@ -122,6 +123,10 @@ public XContentString optimizedText() throws IOException {
122123
if (currentToken().isValue() == false) {
123124
throwOnNoText();
124125
}
126+
var parser = this.parser;
127+
if (parser instanceof FilteringParserDelegate delegate) {
128+
parser = delegate.delegate();
129+
}
125130
if (parser instanceof ESUTF8StreamJsonParser esParser) {
126131
var bytesRef = esParser.getValueAsText();
127132
if (bytesRef != null) {

0 commit comments

Comments
 (0)