Hi,

In the JUnit test case from the attached file, I call "IndexInput.seek()" on a 
position past
EOF. However, there is no EOFException that is thrown.

To reproduce the error, please use the seed test: -Dtests.seed=8273A81C129D35E2

Could you confirm that this is indeed a bug, or if it is a misuse of the
API on my part.

If you do confirm it as a bug, I will open an issue on JIRA with a
patch.

Thanks,

-- 
Stéphane Campinas
  public void testShouldThrowEOFException() throws Exception {
    final Random random = random();

    try (Directory dir = newDirectory()) {
      final int len = 16 + random().nextInt(2048) / 16 * 16;
      final byte[] bytes = new byte[len];

      try (IndexOutput os = dir.createOutput("foo", newIOContext(random))) {
        os.writeBytes(bytes, bytes.length);
      }

      try (IndexInput is = dir.openInput("foo", newIOContext(random))) {
        try {
          is.seek(0);
          // Here, I go past EOF.
          is.seek(len + random().nextInt(2048));
          // since EOF is not enforced by the previous call in RAMInputStream
          // this call to readBytes should throw the exception.
          is.readBytes(bytes, 0, 16);
          fail("Did not get EOFException");
        } catch (EOFException eof) {
          // pass
        }
      }
    }
  }

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to