Skip to content

Commit d9dae3f

Browse files
authored
Fix DeserializingConnectionCallbackTest negative-length assertion (#9081)
1 parent 4152128 commit d9dae3f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

storm-client/test/jvm/org/apache/storm/messaging/DeserializingConnectionCallbackTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ public void testJavaFallbackNegativeLengthDroppedAndBatchContinues() {
164164
byte[] bytes = serializedTuple(conf, Collections.singletonList(new JavaSerializedValue()));
165165

166166
// SerializableSerializer writes the java-serialization byte count right before the stream header;
167-
// an all-bits-set count makes it allocate a negative-length array.
167+
// an all-bits-set count reads back as a negative length, which the serializer rejects before allocation.
168168
int headerIdx = indexOf(bytes, JAVA_STREAM_HEADER, 0);
169169
assertTrue(headerIdx >= 4, "java serialization header not found in tuple payload");
170170
for (int i = 1; i <= 4; i++) {
171171
bytes[headerIdx - i] = (byte) 0xFF;
172172
}
173173

174-
assertThrows(NegativeArraySizeException.class, () -> new KryoTupleDeserializer(conf, context).deserialize(bytes));
174+
assertThrows(KryoException.class, () -> new KryoTupleDeserializer(conf, context).deserialize(bytes));
175175

176176
assertBatchDeliversOnlyValidMessages(conf, bytes);
177177
}

0 commit comments

Comments
 (0)