◐ Shell
clean mode source ↗

core: Fix ClassCastException when array values is set as List by takezoe · Pull Request #794 · msgpack/msgpack-java

Conversation

@takezoe

java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class [Lorg.msgpack.value.Value; ([Ljava.lang.Object; is in module java.base of loader 'bootstrap'; [Lorg.msgpack.value.Value; is in unnamed module of loader 'app')
        at org.msgpack.value.Variable$ArrayValueAccessor.array(Variable.java:890)
        at org.msgpack.value.Variable$ArrayValueAccessor.immutableValue(Variable.java:851)
        at org.msgpack.value.Variable$ArrayValueAccessor.immutableValue(Variable.java:832)
        at org.msgpack.value.Variable.immutableValue(Variable.java:1136)
        at org.msgpack.value.Variable.toJson(Variable.java:1161)

takezoe

this.type = Type.LIST;
this.accessor = arrayAccessor;
this.objectValue = v.toArray();
this.objectValue = v.toArray(new Value[v.size()]);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ClassCastException occurs here:

public Value[] array()
{
return (Value[]) objectValue;
}

@xerial xerial changed the title Fix ClassCastException when array values is set as List core: Fix ClassCastException when array values is set as List

Jan 21, 2024

Labels

2 participants

@takezoe @xerial