Skip to content

Commit e2ebb92

Browse files
committed
Add textRefOrNull to DotExpandingXContentParser
1 parent 702ada2 commit e2ebb92

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

server/src/main/java/org/elasticsearch/index/mapper/DotExpandingXContentParser.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
package org.elasticsearch.index.mapper;
1111

1212
import org.elasticsearch.core.CheckedFunction;
13+
import org.elasticsearch.xcontent.ESBytesRef;
1314
import org.elasticsearch.xcontent.FilterXContentParser;
1415
import org.elasticsearch.xcontent.FilterXContentParserWrapper;
1516
import org.elasticsearch.xcontent.XContentLocation;
@@ -379,6 +380,14 @@ public void skipChildren() throws IOException {
379380
}
380381
}
381382

383+
@Override
384+
public ESBytesRef textRefOrNull() throws IOException {
385+
if (state == State.EXPANDING_START_OBJECT) {
386+
throw new IllegalStateException("Can't get text on a " + currentToken() + " at " + getTokenLocation());
387+
}
388+
return super.textRefOrNull();
389+
}
390+
382391
@Override
383392
public String textOrNull() throws IOException {
384393
if (state == State.EXPANDING_START_OBJECT) {

0 commit comments

Comments
 (0)