Skip to content

Commit cd0c8b1

Browse files
committed
Removes a test that's not anymore valid. Not int math happens in code, but an OOM error is thrown from JDK libraries if an int overflow happens.
1 parent 37ef8c3 commit cd0c8b1

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

logstash-core/src/test/java/org/logstash/common/BufferedTokenizerWithSizeLimitTest.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -135,29 +135,4 @@ public void givenFragmentThatHasTheSecondTokenOverrunsSizeLimitThenAnErrorIsThro
135135
// third token resumes
136136
assertEquals("ccc", tokensIterator.next());
137137
}
138-
139-
@Test
140-
public void givenTooLongInputExtractDoesntOverflow() {
141-
assertEquals("Xmx must equals to what's defined in the Gradle's javaTests task",
142-
12L * GB, Runtime.getRuntime().maxMemory());
143-
144-
// re-init the tokenizer with big sizeLimit
145-
initSUTWithSizeLimit((int) ((2L * GB) - 3));
146-
// Integer.MAX_VALUE is 2 * GB
147-
String bigFirstPiece = generateString("a", Integer.MAX_VALUE - 1024);
148-
sut.extract(bigFirstPiece);
149-
150-
// add another small fragment to trigger int overflow
151-
// sizeLimit is (2^32-1)-3 first segment length is (2^32-1) - 1024 second is 1024 +2
152-
// so the combined length of first and second is > sizeLimit and should throw an expection
153-
// but because of overflow it's negative and happens to be < sizeLimit
154-
Exception thrownException = assertThrows(IllegalStateException.class, () -> {
155-
sut.extract(generateString("a", 1024 + 2)).iterator().next();
156-
});
157-
assertThat(thrownException.getMessage(), containsString("input buffer full"));
158-
}
159-
160-
private String generateString(String fill, int size) {
161-
return fill.repeat(size);
162-
}
163138
}

0 commit comments

Comments
 (0)