Apache Lucene open-source search software
Removing unused parameter in MemorySegmentIndexInput (#15033)
Ankit Jainc485e4889d4e
diff --git a/lucene/core/src/java/org/apache/lucene/store/MemorySegmentIndexInput.java b/lucene/core/src/java/org/apache/lucene/store/MemorySegmentIndexInput.javaindex 3967b400a41..a44232b3674 100644--- a/lucene/core/src/java/org/apache/lucene/store/MemorySegmentIndexInput.java+++ b/lucene/core/src/java/org/apache/lucene/store/MemorySegmentIndexInput.java@@ -115,9 +115,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme}}- // the unused parameter is just to silence javac about unused variables- RuntimeException handlePositionalIOOBE(RuntimeException unused, String action, long pos)- throws IOException {+ RuntimeException handlePositionalIOOBE(String action, long pos) throws IOException {if (pos < 0L) {return new IllegalArgumentException(action + " negative position (pos=" + pos + "): " + this);} else {@@ -322,8 +320,8 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegmethis.curSegment = seg;}this.curPosition = Objects.checkIndex(pos & chunkSizeMask, curSegment.byteSize() + 1);- } catch (IndexOutOfBoundsException e) {- throw handlePositionalIOOBE(e, "seek", pos);+ } catch (IndexOutOfBoundsException _) {+ throw handlePositionalIOOBE("seek", pos);}}@@ -442,8 +440,8 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegmetry {final int si = (int) (pos >> chunkSizePower);return segments[si].get(LAYOUT_BYTE, pos & chunkSizeMask);- } catch (IndexOutOfBoundsException ioobe) {- throw handlePositionalIOOBE(ioobe, "read", pos);+ } catch (IndexOutOfBoundsException _) {+ throw handlePositionalIOOBE("read", pos);} catch (NullPointerException | IllegalStateException e) {throw alreadyClosed(e);}@@ -484,8 +482,8 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegmecurAvail = segments[si].byteSize();}MemorySegment.copy(segments[si], LAYOUT_BYTE, pos, b, offset, len);- } catch (IndexOutOfBoundsException ioobe) {- throw handlePositionalIOOBE(ioobe, "read", pos);+ } catch (IndexOutOfBoundsException _) {+ throw handlePositionalIOOBE("read", pos);} catch (NullPointerException | IllegalStateException e) {throw alreadyClosed(e);}@@ -499,8 +497,8 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegmethis.curPosition = pos & chunkSizeMask;this.curSegmentIndex = si;this.curSegment = seg;- } catch (IndexOutOfBoundsException ioobe) {- throw handlePositionalIOOBE(ioobe, "read", pos);+ } catch (IndexOutOfBoundsException _) {+ throw handlePositionalIOOBE("read", pos);} catch (NullPointerException | IllegalStateException e) {throw alreadyClosed(e);}@@ -748,8 +746,8 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegmeensureOpen();try {curPosition = Objects.checkIndex(pos, length + 1);- } catch (IndexOutOfBoundsException e) {- throw handlePositionalIOOBE(e, "seek", pos);+ } catch (IndexOutOfBoundsException _) {+ throw handlePositionalIOOBE("seek", pos);}}@@ -763,8 +761,8 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegmepublic byte readByte(long pos) throws IOException {try {return curSegment.get(LAYOUT_BYTE, pos);- } catch (IndexOutOfBoundsException e) {- throw handlePositionalIOOBE(e, "read", pos);+ } catch (IndexOutOfBoundsException _) {+ throw handlePositionalIOOBE("read", pos);} catch (NullPointerException | IllegalStateException e) {throw alreadyClosed(e);}@@ -774,8 +772,8 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegmepublic void readBytes(long pos, byte[] bytes, int offset, int length) throws IOException {try {MemorySegment.copy(curSegment, LAYOUT_BYTE, pos, bytes, offset, length);- } catch (IndexOutOfBoundsException e) {- throw handlePositionalIOOBE(e, "read", pos);+ } catch (IndexOutOfBoundsException _) {+ throw handlePositionalIOOBE("read", pos);} catch (NullPointerException | IllegalStateException e) {throw alreadyClosed(e);}@@ -785,8 +783,8 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegmepublic short readShort(long pos) throws IOException {try {return curSegment.get(LAYOUT_LE_SHORT, pos);- } catch (IndexOutOfBoundsException e) {- throw handlePositionalIOOBE(e, "read", pos);+ } catch (IndexOutOfBoundsException _) {+ throw handlePositionalIOOBE("read", pos);} catch (NullPointerException | IllegalStateException e) {throw alreadyClosed(e);}@@ -796,8 +794,8 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegmepublic int readInt(long pos) throws IOException {try {return curSegment.get(LAYOUT_LE_INT, pos);- } catch (IndexOutOfBoundsException e) {- throw handlePositionalIOOBE(e, "read", pos);+ } catch (IndexOutOfBoundsException _) {+ throw handlePositionalIOOBE("read", pos);} catch (NullPointerException | IllegalStateException e) {throw alreadyClosed(e);}@@ -807,8 +805,8 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegmepublic long readLong(long pos) throws IOException {try {return curSegment.get(LAYOUT_LE_LONG, pos);- } catch (IndexOutOfBoundsException e) {- throw handlePositionalIOOBE(e, "read", pos);+ } catch (IndexOutOfBoundsException _) {+ throw handlePositionalIOOBE("read", pos);} catch (NullPointerException | IllegalStateException e) {throw alreadyClosed(e);}@@ -819,8 +817,8 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegmetry {Objects.checkIndex(pos + len, this.length + 1);return curSegment.asSlice(pos, len);- } catch (IndexOutOfBoundsException e) {- throw handlePositionalIOOBE(e, "segmentSliceOrNull", pos);+ } catch (IndexOutOfBoundsException _) {+ throw handlePositionalIOOBE("segmentSliceOrNull", pos);}}@@ -855,9 +853,8 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme}@Override- RuntimeException handlePositionalIOOBE(RuntimeException unused, String action, long pos)- throws IOException {- return super.handlePositionalIOOBE(unused, action, pos - offset);+ RuntimeException handlePositionalIOOBE(String action, long pos) throws IOException {+ return super.handlePositionalIOOBE(action, pos - offset);}@Override@@ -899,7 +896,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme@Overridepublic MemorySegment segmentSliceOrNull(long pos, long len) throws IOException {if (pos + len > length) {- throw handlePositionalIOOBE(null, "segmentSliceOrNull", pos);+ throw handlePositionalIOOBE("segmentSliceOrNull", pos);}pos = pos + offset;final int si = (int) (pos >> chunkSizePower);