diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index e67a9d15201..29a41fdaed8 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -92,6 +92,8 @@ Bug Fixes * SOLR-9882: 500 error code on breaching timeAllowed by core and distributed (fsv) search, old and json facets (Mikhail Khludnev) +* SOLR-13285: Updates with enum fields and javabin cause ClassCastException (noble) + Improvements ---------------------- * SOLR-12999: Index replication could delete segments before downloading segments from master if there is not enough diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java index 4295d25148b..434e2f90d9f 100644 --- a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java +++ b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java @@ -53,6 +53,8 @@ import org.noggit.CharArr; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.apache.solr.common.util.ByteArrayUtf8CharSequence.convertCharSeq; + /** * Defines a space-efficient serialization/deserialization format for transferring data. *
@@ -818,7 +820,7 @@ public class JavaBinCodec implements PushWriter { */ public EnumFieldValue readEnumFieldValue(DataInputInputStream dis) throws IOException { Integer intValue = (Integer) readVal(dis); - String stringValue = (String) readVal(dis); + String stringValue = (String) convertCharSeq (readVal(dis)); return new EnumFieldValue(intValue, stringValue); } diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java b/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java index 671737528ed..0e0ad88453e 100644 --- a/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java +++ b/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java @@ -65,6 +65,20 @@ public class TestJavaBinCodec extends SolrTestCaseJ4 { } } + public void testReadAsCharSeq() throws Exception { + List