Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 78540 invoked from network); 14 Nov 2007 13:53:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Nov 2007 13:53:10 -0000 Received: (qmail 48860 invoked by uid 500); 14 Nov 2007 13:52:51 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 48807 invoked by uid 500); 14 Nov 2007 13:52:51 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 48796 invoked by uid 99); 14 Nov 2007 13:52:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Nov 2007 05:52:51 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Nov 2007 13:53:03 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 1AB2B714209 for ; Wed, 14 Nov 2007 05:52:43 -0800 (PST) Message-ID: <30262526.1195048363075.JavaMail.jira@brutus> Date: Wed, 14 Nov 2007 05:52:43 -0800 (PST) From: "michael streeton (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Updated: (LUCENE-1054) TermDocs.skipTo fails with an ArrayOutOfBoundsException from BitVector In-Reply-To: <1690520.1195048243504.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-1054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] michael streeton updated LUCENE-1054: ------------------------------------- Attachment: Test4.java > TermDocs.skipTo fails with an ArrayOutOfBoundsException from BitVector > ---------------------------------------------------------------------- > > Key: LUCENE-1054 > URL: https://issues.apache.org/jira/browse/LUCENE-1054 > Project: Lucene - Java > Issue Type: Bug > Components: Index, Query/Scoring, Search, Term Vectors > Affects Versions: 2.2 > Environment: Java 1.5 and 1.6 exhibit error. OS Windows XP and Ubunbtu > Reporter: michael streeton > Attachments: Test4.java > > > After a number of calls to TermDocs.skipTo, the following exception is thrown > java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 101306 > at org.apache.lucene.util.BitVector.get(BitVector.java:72) > at org.apache.lucene.index.SegmentTermDocs.next(SegmentTermDocs.java:118) > at org.apache.lucene.index.SegmentTermDocs.skipTo(SegmentTermDocs.java:176) > at org.apache.lucene.index.MultiTermDocs.skipTo(MultiReader.java:413) > This error only occurs in 2.2 works okay in 2.1 and in 2.2 if the index is built using 2.1. The following demonstrates the error. The document being skipTo is not greater than the number of documents in the index. > import java.io.File; > import java.io.IOException; > import java.util.Random; > import org.apache.lucene.analysis.standard.StandardAnalyzer; > import org.apache.lucene.document.Document; > import org.apache.lucene.document.Field; import org.apache.lucene.document.Field.Index; > import org.apache.lucene.document.Field.Store; > import org.apache.lucene.index.CorruptIndexException; > import org.apache.lucene.index.IndexReader; > import org.apache.lucene.index.IndexWriter; > import org.apache.lucene.index.MultiReader; > import org.apache.lucene.index.Term; > import org.apache.lucene.index.TermDocs; import org.apache.lucene.store.FSDirectory; > import org.apache.lucene.store.LockObtainFailedException; > public class Test4 { > /** > * @param args > * @throws IOException > * @throws LockObtainFailedException > * @throws CorruptIndexException > */ > public static void main(String[] args) throws Exception { > Random rand = new Random(0); > FSDirectory[] dirs = new FSDirectory[10]; > boolean build = false; > for (int i = 0; i < dirs.length; i++) { > dirs[i] = FSDirectory.getDirectory("c:" + File.separator + "temp" > + File.separator + "lucenetest" + File.separator > + Integer.toString(i)); > if (!IndexReader.indexExists(dirs[i])) { > if (!build) { > System.out.println("Building Test Index Start"); > } > build = true; > System.out.println("Building Index: " + dirs[i].getFile() > + " Start"); > IndexWriter writer = new IndexWriter(dirs[i], > new StandardAnalyzer(), true); > for (int j = 0; j < 100000; j++) { > Document doc = new Document(); > doc.add(new Field("i", Integer.toString(rand.nextInt(100)), > Store.YES, Index.UN_TOKENIZED)); > doc.add(new Field("j", > Integer.toString(rand.nextInt(1000)), Store.YES, > Index.UN_TOKENIZED)); > writer.addDocument(doc); > } > writer.optimize(); > writer.close(); > writer = null; > System.out.println("Building Index: " + dirs[i].getFile() > + " Complete"); > } > IndexReader reader = IndexReader.open(dirs[i]); > for (int j = 0; j < 1000; j++) { > reader.deleteDocument(rand.nextInt(reader.maxDoc())); > } > reader.close(); > } > if (build) { > System.out.println("Building Test Index Complete"); > } > System.out.println("Test Start"); > IndexReader[] readers = new IndexReader[dirs.length]; > for (int i = 0; i < dirs.length; i++) { > readers[i] = IndexReader.open(dirs[i]); > } > IndexReader reader = new MultiReader(readers); > TermDocs docs = reader.termDocs(); > for (int i = 0; i < 100; i++) { > for (int j = 0; j < 1000; j++) { > try { > test(reader, docs, Integer.toString(i), Integer.toString(j)); > } catch (Exception e) { > System.err.println("maxdoc=" + reader.maxDoc()); > System.err.println("Test Failed at i=" + i + " j=" + j); > throw e; > } > } > } > docs.close(); > reader.close(); > System.out.println("Test Complete"); > } > private static void test(IndexReader reader, TermDocs docs, String i, > String j) throws Exception { > docs.seek(new Term("i", i)); > while (docs.next()) > ; > docs.seek(new Term("j", j)); > while (docs.next()) > ; > docs.seek(new Term("i", i)); > if (docs.next()) { > int doc = docs.doc(); > try { > while (docs.skipTo(doc + 1000)) { > doc = docs.doc(); > } > } catch (Exception e) { > System.err.println("doc=" + (doc + 1000) + ": deleted=" > + reader.isDeleted(doc + 1000)); > throw e; > } > } > docs.seek(new Term("j", j)); > if (docs.next()) { > int doc = docs.doc(); > try { > while (docs.skipTo(doc + 1000)) { > doc = docs.doc(); > } > } catch (Exception e) { > System.err.println("doc=" + doc); > throw e; > } > } > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org