Return-Path: Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: (qmail 62376 invoked from network); 26 May 2010 14:28:00 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 May 2010 14:28:00 -0000 Received: (qmail 7559 invoked by uid 500); 26 May 2010 14:27:59 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 7518 invoked by uid 500); 26 May 2010 14:27:59 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 7510 invoked by uid 99); 26 May 2010 14:27:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 May 2010 14:27:59 +0000 X-ASF-Spam-Status: No, hits=-1467.2 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 May 2010 14:27:58 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o4QERbIN010790 for ; Wed, 26 May 2010 14:27:38 GMT Message-ID: <29528605.21274884057604.JavaMail.jira@thor> Date: Wed, 26 May 2010 10:27:37 -0400 (EDT) From: "Uwe Schindler (JIRA)" To: dev@lucene.apache.org Subject: [jira] Updated: (LUCENE-2478) CachingWrapperFilter throws NPE when Filter.getDocIdSet() returns null In-Reply-To: <7213783.60971274880575289.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LUCENE-2478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Uwe Schindler updated LUCENE-2478: ---------------------------------- Attachment: LUCENE-2478.patch Patch with additional tests from trunk. > CachingWrapperFilter throws NPE when Filter.getDocIdSet() returns null > ---------------------------------------------------------------------- > > Key: LUCENE-2478 > URL: https://issues.apache.org/jira/browse/LUCENE-2478 > Project: Lucene - Java > Issue Type: Bug > Affects Versions: 2.9.1, 2.9.2, 3.0, 3.0.1 > Reporter: Uwe Schindler > Assignee: Uwe Schindler > Fix For: 2.9.3, 3.0.2, 3.1, 4.0 > > Attachments: LUCENE-2478.patch, LUCENE-2478.patch > > > Followup for [http://www.lucidimagination.com/search/document/1014ea92f15677bd/filter_getdocidset_returning_null_and_what_this_means_for_cachingwrapperfilter]: > Daniel Noll is seeing an exception like this: > {noformat} > java.lang.NullPointerException > at org.apache.lucene.search.CachingWrapperFilter.docIdSetToCache(CachingWrapperFilter.java:84) > at org.apache.lucene.search.CachingWrapperFilter.getDocIdSet(CachingWrapperFilter.java:112) > at com.nuix.storage.search.LazyConstantScoreQuery$LazyFilterWrapper.getDocIdSet(SourceFile:91) > at org.apache.lucene.search.ConstantScoreQuery$ConstantScorer.(ConstantScoreQuery.java:116) > at org.apache.lucene.search.ConstantScoreQuery$ConstantWeight.scorer(ConstantScoreQuery.java:81) > at org.apache.lucene.search.BooleanQuery$BooleanWeight.scorer(BooleanQuery.java:297) > at org.apache.lucene.search.BooleanQuery$BooleanWeight.scorer(BooleanQuery.java:297) > at org.apache.lucene.search.QueryWrapperFilter$2.iterator(QueryWrapperFilter.java:75) > {noformat} > The class of our own is just an intermediary which delays creating the Filter object... > {code} > @Override > public DocIdSet getDocIdSet(IndexReader reader) throws IOException { > if (delegate == null) { > delegate = factory.createFilter(); > } > return delegate.getDocIdSet(reader); > } > {code} > Tracing through the code in CachingWrapperFilter, I can see that this NPE would occur if getDocIdSet() were to return null. > The Javadoc on Filter says that null will be returned if no documents will be accepted by the filter, but it doesn't seem that Lucene itself is handling null return values correctly, so which is correct? The code or the Javadoc? Supposing that null really is OK, does this cause any problems with how CachingWrapperFilter is implementing the caching? I notice it's calling get() and then comparing against null so it wouldn't appear that it can distinguish "the entry isn't in the cache" from "the entry is in the cache but it's null". -- 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: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org