I just took a quick peek at the prevBitSet, and the implementation looks buggy (provided that it's legal for a user to pass an "i" that may be greater than the largest bit ever set).
Here is the current code, which will cause an exception when wlen==0. public int prevSetBit(int index) { if (index < 0) { return -1; } int i = index>>6; if (i >= wlen) { i = wlen - 1; } final int subIndex = index & 0x3f; // index within the word long word = (bits[i] << (63-subIndex)); // skip all the bits to the left of index All that needs to be done is to move the negative index check to the bottom (the first index<0 is not needed since we do a signed shift). public int prevSetBit(int index) { int i = index>>6; if (i >= wlen) { i = wlen - 1; } if (i < 0) return -1; final int subIndex = index & 0x3f; // index within the word long word = (bits[i] << (63-subIndex)); // skip all the bits to the left of index -Yonik http://www.lucidimagination.com On Fri, Jun 24, 2011 at 11:33 AM, Robert Muir <rcm...@gmail.com> wrote: > And -Xint and -client > > On Fri, Jun 24, 2011 at 11:32 AM, Uwe Schindler <u...@thetaphi.de> wrote: >> The bug is *not* fixed by replacing Long.numberOfLeadingZeros(word) with >> BitUtils.nlz(word). >> >> So this is really strange. Also happens with -Xbatch. >> >> ----- >> Uwe Schindler >> H.-H.-Meier-Allee 63, D-28213 Bremen >> http://www.thetaphi.de >> eMail: u...@thetaphi.de >> >> >>> -----Original Message----- >>> From: Uwe Schindler [mailto:u...@thetaphi.de] >>> Sent: Friday, June 24, 2011 5:20 PM >>> To: dev@lucene.apache.org >>> Subject: RE: [VOTE] release 3.3 >>> >>> I assume the problem is the intrinsic, I will replace by the own hacker's >>> delight impl (like we do everywhere else in OpenBitSet, why did we use the >>> platform method here?) and try again.... >>> >>> Uwe >>> >>> ----- >>> Uwe Schindler >>> H.-H.-Meier-Allee 63, D-28213 Bremen >>> http://www.thetaphi.de >>> eMail: u...@thetaphi.de >>> >>> >>> > -----Original Message----- >>> > From: Robert Muir [mailto:rcm...@gmail.com] >>> > Sent: Friday, June 24, 2011 5:07 PM >>> > To: dev@lucene.apache.org >>> > Subject: Re: [VOTE] release 3.3 >>> > >>> > Just some more info: i took away the seed and used -Dtests.iter=100 on >>> > this >>> > test: >>> > >>> > JAVA5: >>> > [junit] Testsuite: org.apache.lucene.util.TestOpenBitSet >>> > [junit] Tests run: 400, Failures: 0, Errors: 23, Time elapsed: >>> > 21.793 sec >>> > >>> > JAVA6: >>> > junit-sequential: >>> > [junit] Testsuite: org.apache.lucene.util.TestOpenBitSet >>> > [junit] Tests run: 400, Failures: 0, Errors: 0, Time elapsed: >>> > 19.719 sec >>> > >>> > so this test fails 23% of the time on java5. >>> > >>> > The reason we never caught it, is that java5 is unmaintained and we >>> > cannot even test it in hudson... aka we cannot support this monster >>> anymore!!!! >>> > >>> > On Fri, Jun 24, 2011 at 11:02 AM, Robert Muir <rcm...@gmail.com> wrote: >>> > > On Fri, Jun 24, 2011 at 10:54 AM, Uwe Schindler <u...@thetaphi.de> >>> > wrote: >>> > >> The OpenBitSet test is in all cases serious (vs. the skiplist test >>> > >> is a test bug, >>> > that true). >>> > >> >>> > >> The AIOOBE is caused inside OpenBitSet and that should never ever >>> > happen, even if you use it incorrectly! >>> > > >>> > > Its not clear that its that serious, it only fails with java 5 for >>> > > me (not java 6) :) >>> > > >>> > > Looks like a bug in java 5... >>> > > >>> > >>> > --------------------------------------------------------------------- >>> > 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 >> >> >> >> --------------------------------------------------------------------- >> 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 > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org