Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#823 Fix ArrayIndexOutOfBoundsException in binary search logic #824

Merged
merged 1 commit into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -216,7 +216,7 @@ private CachedField[] readFields (Kryo kryo, Input input) {
}
} else {
int low, mid, high, compare;
int lastFieldIndex = allFields.length;
int lastFieldIndex = allFields.length - 1;
outer:
for (int i = 0; i < length; i++) {
String schemaName = names[i];
Expand Down
Expand Up @@ -415,6 +415,22 @@ private void testRemovedMultipleFieldsFromClassWithManyFields (int length, boole
assertEquals(object1, object2);
}

@Test
void testRemoveAllFieldsFromClassWithManyFields () {
CompatibleFieldSerializer serializer = new CompatibleFieldSerializer<>(kryo, ClassWithManyFields.class);
kryo.register(ClassWithManyFields.class, serializer);

ClassWithManyFields object1 = new ClassWithManyFields();
roundTrip(118, object1);

for (FieldSerializer.CachedField field : serializer.getFields()) {
serializer.removeField(field.getName());
}

ClassWithManyFields object2 = (ClassWithManyFields)kryo.readClassAndObject(input);
assertEquals(object1, object2);
}

@Test
void testExtendedClass () {
testExtendedClass(270, false, false);
Expand Down