According to http://stackoverflow.com/a/8381338, the maximum array size is not Integer.MAX_VALUE, but Integer.MAX_VALUE - 8 Change-Id: I6ddc7470368acd20abf0885c53c89a982bb0f176 Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>tags/v3.5.0.201409071800-rc1
} | } | ||||
final long nameLen = bucketCnt * Constants.OBJECT_ID_LENGTH; | final long nameLen = bucketCnt * Constants.OBJECT_ID_LENGTH; | ||||
if (nameLen > Integer.MAX_VALUE) | |||||
if (nameLen > Integer.MAX_VALUE - 8) // see http://stackoverflow.com/a/8381338 | |||||
throw new IOException(JGitText.get().indexFileIsTooLargeForJgit); | throw new IOException(JGitText.get().indexFileIsTooLargeForJgit); | ||||
final int intNameLen = (int) nameLen; | final int intNameLen = (int) nameLen; |