LUCENE-1519: upcast to long to prevent overflow

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@734415 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-01-14 15:09:57 +00:00
parent 88e19ab531
commit 888af0337d

View File

@ -374,7 +374,7 @@ final class SegmentMerger {
final long fdxFileLength = directory.fileLength(segment + "." + IndexFileNames.FIELDS_INDEX_EXTENSION);
if (4+docCount*8 != fdxFileLength)
if (4+((long) docCount)*8 != fdxFileLength)
// This is most likely a bug in Sun JRE 1.6.0_04/_05;
// we detect that the bug has struck, here, and
// throw an exception to prevent the corruption from
@ -468,7 +468,7 @@ final class SegmentMerger {
final long tvxSize = directory.fileLength(segment + "." + IndexFileNames.VECTORS_INDEX_EXTENSION);
if (4+mergedDocs*16 != tvxSize)
if (4+((long) mergedDocs)*16 != tvxSize)
// This is most likely a bug in Sun JRE 1.6.0_04/_05;
// we detect that the bug has struck, here, and
// throw an exception to prevent the corruption from