Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 91034 invoked from network); 20 Oct 2006 07:10:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Oct 2006 07:10:45 -0000 Received: (qmail 29442 invoked by uid 500); 20 Oct 2006 07:10:33 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 29406 invoked by uid 500); 20 Oct 2006 07:10:33 -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 29390 invoked by uid 99); 20 Oct 2006 07:10:33 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Oct 2006 00:10:33 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Oct 2006 00:10:32 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8BBF27142DF for ; Fri, 20 Oct 2006 00:09:36 -0700 (PDT) Message-ID: <29992811.1161328176567.JavaMail.jira@brutus> Date: Fri, 20 Oct 2006 00:09:36 -0700 (PDT) From: "Otis Gospodnetic (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-689) NullPointerException thrown by equals method in SpanOrQuery In-Reply-To: <2491256.1161221734989.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 X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/LUCENE-689?page=comments#action_12443726 ] Otis Gospodnetic commented on LUCENE-689: ----------------------------------------- Hm, weird. l peeked at SpanOrQuery.java and it looks like the private field instance var should be set in the ctor, using the field from the first clause, no? How come your field is null in the first place? > NullPointerException thrown by equals method in SpanOrQuery > ----------------------------------------------------------- > > Key: LUCENE-689 > URL: http://issues.apache.org/jira/browse/LUCENE-689 > Project: Lucene - Java > Issue Type: Bug > Components: Search > Affects Versions: 2.1 > Environment: Java 1.5.0_09, RHEL 3 Linux, Tomcat 5.0.28 > Reporter: Michael Goddard > > Part of our code utilizes the equals method in SpanOrQuery and, in certain cases (details to follow, if necessary), a NullPointerException gets thrown as a result of the String "field" being null. After applying the following patch, the problem disappeared: > Index: src/java/org/apache/lucene/search/spans/SpanOrQuery.java > =================================================================== > --- src/java/org/apache/lucene/search/spans/SpanOrQuery.java (revision 465065) > +++ src/java/org/apache/lucene/search/spans/SpanOrQuery.java (working copy) > @@ -121,7 +121,8 @@ > final SpanOrQuery that = (SpanOrQuery) o; > if (!clauses.equals(that.clauses)) return false; > - if (!field.equals(that.field)) return false; > + if (field != null && !field.equals(that.field)) return false; > + if (field == null && that.field != null) return false; > return getBoost() == that.getBoost(); > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org