Skip to content

Commit e61688c

Browse files
committed
Fix DotExpandingXContentParser
1 parent 3fcf2f1 commit e61688c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,14 @@ public XContentString optimizedTextOrNull() throws IOException {
388388
return super.optimizedTextOrNull();
389389
}
390390

391+
@Override
392+
public XContentString optimizedText() throws IOException {
393+
if (state == State.EXPANDING_START_OBJECT) {
394+
throw new IllegalStateException("Can't get text on a " + currentToken() + " at " + getTokenLocation());
395+
}
396+
return super.optimizedText();
397+
}
398+
391399
@Override
392400
public String textOrNull() throws IOException {
393401
if (state == State.EXPANDING_START_OBJECT) {
@@ -396,6 +404,14 @@ public String textOrNull() throws IOException {
396404
return super.textOrNull();
397405
}
398406

407+
@Override
408+
public String text() throws IOException {
409+
if (state == State.EXPANDING_START_OBJECT) {
410+
throw new IllegalStateException("Can't get text on a " + currentToken() + " at " + getTokenLocation());
411+
}
412+
return super.text();
413+
}
414+
399415
@Override
400416
public Number numberValue() throws IOException {
401417
if (state == State.EXPANDING_START_OBJECT) {

0 commit comments

Comments
 (0)