]> source.dussan.org Git - jgit.git/commit
[errorprone] Fix wrong comparison which always evaluated to false 47/204347/1
authorMatthias Sohn <matthias.sohn@sap.com>
Fri, 15 Sep 2023 09:48:05 +0000 (11:48 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Fri, 15 Sep 2023 10:12:25 +0000 (12:12 +0200)
commit916200e278ebeaa2602b5dc23143c8eedf11858b
tree593d24d6ad7136486321d038826cc42415f86fa9
parentcf5ec856bda907c0537ce5a80246b9ab18195c8b
[errorprone] Fix wrong comparison which always evaluated to false

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/GraphObjectIndex.java:59:
error: [ComparisonOutOfRange] ints may have a value in the range
-2147483648 to 2147483647; therefore, this comparison to
Integer.MAX_VALUE will always evaluate to false
if (table[k] > Integer.MAX_VALUE) {
             ^

See https://errorprone.info/bugpattern/ComparisonOutOfRange

We need to check if variable `uint` of type `long` exceeds the maximum
possible int value before casting it to `int` below.

This was introduced in Ib5c0d6678cb242870a0f5841bd413ad3885e95f6

Change-Id: I675d594f523084be4c1678328cc343065e32d998
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/GraphObjectIndex.java