diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2019-05-04 09:43:24 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2019-05-06 11:01:16 +0200 |
commit | baf8ce1ddc8136eaf3dac8424830b8960991ee21 (patch) | |
tree | d89907876a91f446fcba3e101526c54cff22e09f /sonar-core/src/test | |
parent | 18054cb90101629237e6876e7e5334badd54084f (diff) | |
download | sonarqube-baf8ce1ddc8136eaf3dac8424830b8960991ee21.tar.gz sonarqube-baf8ce1ddc8136eaf3dac8424830b8960991ee21.zip |
SONAR-12078 out of memory in CE if file has too many issues
Diffstat (limited to 'sonar-core/src/test')
-rw-r--r-- | sonar-core/src/test/java/org/sonar/core/issue/tracking/BlockRecognizerTest.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/issue/tracking/BlockRecognizerTest.java b/sonar-core/src/test/java/org/sonar/core/issue/tracking/BlockRecognizerTest.java index 9164a04b82d..c6046dcb322 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/tracking/BlockRecognizerTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/tracking/BlockRecognizerTest.java @@ -41,6 +41,15 @@ public class BlockRecognizerTest { assertThat(compute(seq("bcde"), seq("abcde"), 3, 4)).isEqualTo(4); } + @Test + public void isOverLimit() { + assertThat(BlockRecognizer.isOverLimit(20, 40)).isFalse(); + assertThat(BlockRecognizer.isOverLimit(3, 100_000)).isTrue(); + + // multiplication of these two ints is higher than Integer.MAX_VALUE + assertThat(BlockRecognizer.isOverLimit(50_000, 60_000)).isTrue(); + } + private int compute(LineHashSequence seqA, LineHashSequence seqB, int ai, int bi) { return BlockRecognizer.lengthOfMaximalBlock(seqA, ai, seqB, bi); } |