Skip to content

Commit

Permalink
fix: Boxed primitives trigger ClassCastException in ArrayPreview for …
Browse files Browse the repository at this point in the history
…protobuf repeated fields (deephaven#6434)

The fix is taken from code in
deephaven#6065.
That branch has been in WIP state for several months and we need this
fix for DHE.
fixes deephaven#6433
  • Loading branch information
jcferretti authored Dec 2, 2024
1 parent 4f397ab commit efad062
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//
package io.deephaven.engine.table.impl.preview;

import io.deephaven.util.type.TypeUtils;
import io.deephaven.vector.Vector;
import io.deephaven.vector.VectorFactory;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -34,7 +35,9 @@ public static ArrayPreview fromArray(final Object array) {
if (componentType == boolean.class) {
return new ArrayPreview(convertToString((boolean[]) array));
}
return new ArrayPreview(VectorFactory.forElementType(componentType)
// Boxed primitives need the Object wrapper.
final Class<?> elementType = TypeUtils.isBoxedType(componentType) ? Object.class : componentType;
return new ArrayPreview(VectorFactory.forElementType(elementType)
.vectorWrap(array)
.toString(ARRAY_SIZE_CUTOFF));
}
Expand Down

0 comments on commit efad062

Please sign in to comment.