Skip to content

Commit 389376e

Browse files
author
Zhen
committed
Fixed the bug in the test that it tests chunksize beyond [1, 0xFFFF]
1 parent 82e6911 commit 389376e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

driver/src/test/java/org/neo4j/driver/internal/connector/socket/BufferingChunkedInputFuzzTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ public void shouldHandleAllMessageBoundaries() throws IOException
5454
@Test
5555
public void messageSizeFuzzTest() throws IOException
5656
{
57-
int maxSize = 1 << 16;
57+
int maxSize = 1 << 16; // 0x10000
5858
Random random = new Random();
5959
for ( int i = 0; i < 1000; i++)
6060
{
61-
int size = random.nextInt( maxSize + 1);
61+
int size = random.nextInt( maxSize - 1 ) + 1; //[0, 0xFFFF - 1] + 1 = [1, 0xFFFF]
6262
byte[] expected = new byte[size];
6363
Arrays.fill(expected, (byte)42);
6464
BufferingChunkedInput input = new BufferingChunkedInput( channel( expected, 0, size ) );
@@ -152,4 +152,4 @@ public void close() throws IOException
152152
}
153153
};
154154
}
155-
}
155+
}

0 commit comments

Comments
 (0)