Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 6531 invoked from network); 22 Oct 2003 16:07:06 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 22 Oct 2003 16:07:06 -0000 Received: (qmail 16923 invoked by uid 500); 22 Oct 2003 16:06:56 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 16707 invoked by uid 500); 22 Oct 2003 16:06:55 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 16693 invoked from network); 22 Oct 2003 16:06:55 -0000 Received: from unknown (HELO web12703.mail.yahoo.com) (216.136.173.240) by daedalus.apache.org with SMTP; 22 Oct 2003 16:06:55 -0000 Message-ID: <20031022160656.85205.qmail@web12703.mail.yahoo.com> Received: from [194.152.224.89] by web12703.mail.yahoo.com via HTTP; Wed, 22 Oct 2003 09:06:56 PDT Date: Wed, 22 Oct 2003 09:06:56 -0700 (PDT) From: Otis Gospodnetic Subject: Re: Weird NPE in RAMInputStream when merging indices To: Lucene Users List In-Reply-To: <841B770F-03E7-11D8-8979-000393760B7E@mac.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hm, beat me. The code in question seems to be: public RAMInputStream(RAMFile f) { file = f; length = file.length; } ...which is called from: /** Returns a stream reading an existing file. */ public final InputStream openFile(String name) { RAMFile file = (RAMFile)files.get(name); return new RAMInputStream(file); } Since 'files' is a Hashtable, neither the key nor the value (file) can be null, even though the NPE in RAMInputStream constructor implies that file was null. Otis --- petite_abeille wrote: > Hello, > > What could cause such weird exception? > > RAMInputStream.: java.lang.NullPointerException > java.lang.NullPointerException > at > org.apache.lucene.store.RAMInputStream.(RAMDirectory.java:217) > at > org.apache.lucene.store.RAMDirectory.openFile(RAMDirectory.java:182) > at org.apache.lucene.index.FieldInfos.(FieldInfos.java:78) > at > org.apache.lucene.index.SegmentReader.(SegmentReader.java:116) > at > org.apache.lucene.index.IndexWriter.mergeSegments(IndexWriter.java:378) > at org.apache.lucene.index.IndexWriter.optimize(IndexWriter.java:298) > at > org.apache.lucene.index.IndexWriter.addIndexes(IndexWriter.java:313) > > I don't know if this is a one off as I cannot reproduce this problem > nor I have seen this before, but I thought I could as well ask. > > This is triggered by merging a RAMDirectory into a FSDirectory. > Looking > at the RAMDirectory source code, this exception seems to indicate > that > the file argument to the RAMInputStream constructor is null... how > could that ever happen? > > Here is the code which triggers this weirdness: > > this.writer().addIndexes( new Directory[] { aRamDirectory } ); > > The RAM writer is checked before invoking this code to make sure > there > is some content in the RAM directory: > > aRamWriter.docCount() > 0 > > This has been working very reliably since the dawn of time, so I'm a > little bit at loss as how to diagnose this weird exception... > > Any ideas? > > Thanks. > > Cheers, > > PA. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: lucene-user-help@jakarta.apache.org > __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org