Skip to content

Commit 31c6392

Browse files
committed
Use toString instead of string cast
1 parent 78a9929 commit 31c6392

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ protected BytesRef toBytesRef(Object v) {
382382
if (v instanceof BytesRef b) {
383383
return b;
384384
} else {
385-
return BlockSourceReader.toBytesRef(scratch, (String) v);
385+
assert v instanceof String;
386+
return BlockSourceReader.toBytesRef(scratch, v.toString());
386387
}
387388
}
388389
};

0 commit comments

Comments
 (0)