Return-Path: Delivered-To: apmail-jakarta-lucene-dev-archive@apache.org Received: (qmail 27973 invoked from network); 19 Sep 2002 11:19:07 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 19 Sep 2002 11:19:07 -0000 Received: (qmail 27543 invoked by uid 97); 19 Sep 2002 11:19:43 -0000 Delivered-To: qmlist-jakarta-archive-lucene-dev@jakarta.apache.org Received: (qmail 27504 invoked by uid 97); 19 Sep 2002 11:19:42 -0000 Mailing-List: contact lucene-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Developers List" Reply-To: "Lucene Developers List" Delivered-To: mailing list lucene-dev@jakarta.apache.org Received: (qmail 27482 invoked by uid 98); 19 Sep 2002 11:19:41 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) From: "Rasik Pandey" To: "'Lucene Developers List'" Subject: RE : RE : RE : Nullpointer in code Date: Thu, 19 Sep 2002 13:20:02 +0200 Organization: AJLSM Message-ID: <001e01c25fce$7fca6ef0$697ba8c0@DIDEROT> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 In-Reply-To: <20020919060916.18753.qmail@web12703.mail.yahoo.com> Importance: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Yes the change was finally in WildCardTermEnum. My apologies for the less than concise original mail....... -----Message d'origine----- De : Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]=20 Envoy=E9 : jeudi 19 septembre 2002 08:09 =C0 : Lucene Developers List Objet : Re: RE : RE : Nullpointer in code Ah, that explains the large diff. The diff is for WildCardTermEnum? Maybe Doug can comment before we start with defensive programming... Otis --- Rasik Pandey wrote: > The only significant change in the diff which I sent was this: >=20 > 95c98 > < if (field =3D=3D term.field()) { > --- > > if (term !=3D null && field =3D=3D term.field()) { > 104c107 >=20 >=20 > The other changes were just from my IDE reformatting the code. >=20 > -----Message d'origine----- > De : Rasik Pandey [mailto:rasik.pandey@ajlsm.com] > Envoy=E9 : jeudi 12 septembre 2002 19:06 > =C0 : 'Lucene Developers List' > Objet : RE : Nullpointer in code >=20 >=20 > Otis, > Here a the test program that will generate the null pointer and the=20 > requested diff. Hope they are helpful. >=20 > Thanks, > Rasik Pandey >=20 >=20 >=20 > -----Message d'origine----- > De : Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com] > Envoy=E9 : jeudi 12 septembre 2002 18:23 > =C0 : Lucene Developers List > Cc : rasik.pandey@ajlsm.com > Objet : Re: Nullpointer in code >=20 >=20 > Rasik, >=20 > Thanks for feedback, but that stuff is a bit hard to read. The best=20 > way to help would be to write a class that demonstrates this, > then fix your code to work, then make a diff between your fixed code > and > the code in the CVS, and finally, it would be great to have a unit > test > for it, but I can write that later. >=20 > Thanks, > Otis >=20 >=20 > --- Rasik Pandey wrote: > > Developers, > > I am encountering a null pointer exception when executing a wild > card > > query search on an empty index which doesn't contain any terms and > of > > course not the Term generated from the wild card query (ie the=20 > > WildCardTermEnum has an empty "actualEnum"). Please see below for=20 > > what i propose to be the fix (simple). I assume that this is=20 > > sufficient or would a change in one of the SegmentReader or=20 > > TermsInfosReader classes > > be more appropriate (not likely)? > >=20 > > I do not have access to commit this change, so if you deem that it > is > > necessary can you please make the modification. > >=20 > > Cheers, > > Rasik Pandey > >=20 > > Basically in the constructor of WildCardTermEnum the constructor=20 > > calls; > >=20 > > setEnum(reader.terms(new Term(searchTerm.field(), pre))); > > ----or > > super.setEnum(an empty termEnum); or > FilteredTermEnum.setEnum(an > > empty termEnum); > >=20 > >=20 > > Then in FilteredTermnEnum: > > protected void setEnum(TermEnum actualEnum) throws IOException { > > this.actualEnum =3D actualEnum; > > // Find the first term that matches > > =20 > >=20 > > !!!!!!!!the result of actualEnum.term(); is null in my > case!!!!!!!!! > > Term term =3D actualEnum.term(); > > =20 > > > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > > =20 > >=20 > > !!!!!!!!!!!!the below line leads to the null > pointer!!!!!!!!!! > > if (termCompare(term))=20 > > !!!!!!!!!!!!!!!!!!!!see > below!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > >=20 > > currentTerm =3D term; > > else next(); > > } > >=20 > >=20 > > Then back in WildCardTermEnum: > >=20 > > final protected boolean termCompare(Term term) { > > !!!!!!!!!!!the below line should test to ensure that "term" > is > > not null!!!!!! > > if (field =3D=3D term.field()) { > > !!!!!!!!!!!!!!!!see below line for the simple=20 > > fix!!!!!!!!!!!!!!!!!!!!!!!!!!!! > > =20 > > !!!!!!!!!!!!!!!!!below is the changed line for the simple=20 > > fix!!!!!!!!!!!!!!!!!!!!!!!! > > if (term !=3D null && field =3D=3D term.field()) { > > =09 > > > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > > !!!!!!!!!!!!! > > String searchText =3D term.text(); > > if (searchText.startsWith(pre)) { > > return wildcardEquals(text, 0, searchText, preLen); > > } > > } > > endEnum =3D true; > > return false; > > } > >=20 > >=20 > > -- > > To unsubscribe, e-mail: > > > > For additional commands, e-mail:=20 > > > >=20 >=20 >=20 > __________________________________________________ > Yahoo! - We Remember > 9-11: A tribute to the more than 3,000 lives lost=20 > http://dir.remember.yahoo.com/tribute >=20 > -- > To unsubscribe, e-mail:=20 > > For additional commands, e-mail:=20 > >=20 >=20 > -- > To unsubscribe, e-mail: > > For additional commands, e-mail: > >=20 __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com -- To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: