GH-13315: Fix IndexOutOfBoundsException thrown in DefaultPassageFormatter by unordered matches

2024-06-20 Thread Stéphane Campinas
Hello,

I have made requested changes to the PR 
https://github.com/apache/lucene/pull/13315.
Please tell me if I need to add something else to it!

Thanks,
-- 
Stephane Campinas


signature.asc
Description: PGP signature


Expected EOFException is not thrown

2015-12-15 Thread Stéphane Campinas
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: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Re: Expected EOFException is not thrown

2015-12-15 Thread Stéphane Campinas
https://issues.apache.org/jira/browse/LUCENE-6932

On 15 December 2015 at 15:03, Robert Muir <rcm...@gmail.com> wrote:

> at a glance, this looks like a bug in RAMDirectory to me. Can you open an
> issue?
>
> On Tue, Dec 15, 2015 at 9:52 AM, Stéphane Campinas
> <stephane.campi...@gmail.com> wrote:
> > 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
> >
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
> > For additional commands, e-mail: dev-h...@lucene.apache.org
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
> For additional commands, e-mail: dev-h...@lucene.apache.org
>
>


-- 
Campinas Stéphane