LUCENE-1144: fix NPE during DW.abort after OOM error

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@613645 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2008-01-20 18:35:26 +00:00
parent 17fede30c0
commit 9b2c39f75d
1 changed files with 10 additions and 10 deletions

View File

@ -2883,13 +2883,13 @@ final class DocumentsWriter {
}
public void nextBuffer() {
bufferUpto++;
if (bufferUpto == buffers.length) {
byte[][] newBuffers = new byte[(int) (bufferUpto*1.5)][];
System.arraycopy(buffers, 0, newBuffers, 0, bufferUpto);
if (1+bufferUpto == buffers.length) {
byte[][] newBuffers = new byte[(int) (buffers.length*1.5)][];
System.arraycopy(buffers, 0, newBuffers, 0, buffers.length);
buffers = newBuffers;
}
buffer = buffers[bufferUpto] = getByteBlock();
buffer = buffers[1+bufferUpto] = getByteBlock();
bufferUpto++;
byteUpto = 0;
byteOffset += BYTE_BLOCK_SIZE;
@ -2956,13 +2956,13 @@ final class DocumentsWriter {
}
public void nextBuffer() {
bufferUpto++;
if (bufferUpto == buffers.length) {
char[][] newBuffers = new char[(int) (bufferUpto*1.5)][];
System.arraycopy(buffers, 0, newBuffers, 0, bufferUpto);
if (1+bufferUpto == buffers.length) {
char[][] newBuffers = new char[(int) (buffers.length*1.5)][];
System.arraycopy(buffers, 0, newBuffers, 0, buffers.length);
buffers = newBuffers;
}
buffer = buffers[bufferUpto] = getCharBlock();
buffer = buffers[1+bufferUpto] = getCharBlock();
bufferUpto++;
byteUpto = 0;
byteOffset += CHAR_BLOCK_SIZE;