lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <DCutt...@grandcentral.com>
Subject RE: Proposed changes to SegmentsReader and TermInfosReader
Date Wed, 10 Oct 2001 16:58:05 GMT
1. Your diffs are hard to read!  Why the square brackets?  Also, it looks
like you re-indented and added brackets to some code that you did not
change, so that it shows up in the diffs.  That's a no-no in my book.
Personally I prefer the '-u' and '-w' flags to 'diff'.  If you're using 'cvs
diff' to generate diffs from the checked-in version, then you can just put
the line 'diff -uw' in ~/.cvsrc.

2. This doesn't look very risky.  If I'm parsing the diffs correctly, it's
really just two one-line changes to check for null pointers.  So I'm
inclined to let it into 1.2RC2.  Objections?

Doug

> -----Original Message-----
> From: Scott Ganyo [mailto:scott.ganyo@eTapestry.com]
> Sent: Wednesday, October 10, 2001 9:10 AM
> To: Lucene-Dev (E-mail)
> Subject: Proposed changes to SegmentsReader and TermInfosReader
> 
> 
> I'm getting a NullPointerException when a requested Term is 
> greater than
> (using compareTo) all existing Terms in a given segment.  Here are my
> proposed changes:
> 
> [Index: SegmentsReader.java]
> [===================================================================]
> [RCS file:
> /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/Segm
> entsReader.jav
> a,v]
> [retrieving revision 1.1.1.1]
> [diff -r1.1.1.1 SegmentsReader.java]
> [181,191c182,195]
> [<       if (t != null) {]
> [< 	termEnum = (SegmentTermEnum)reader.terms(t);]
> [<       } else]
> [< 	termEnum = (SegmentTermEnum)reader.terms();]
> [<       ]
> [<       SegmentMergeInfo smi = new 
> SegmentMergeInfo(starts[i], termEnum,
> reader);]
> [<       if (t == null ? smi.next() : termEnum.term() != null)]
> [< 	queue.put(smi);				  // initialize queue]
> [<       else]
> [< 	smi.close();]
> [<     }]
> [---]
> [>            if (t != null) {]
> [>                termEnum = (SegmentTermEnum)reader.terms(t);]
> [>            } else {]
> [>                termEnum = (SegmentTermEnum)reader.terms();]
> [>            }]
> [>            ]
> [>            if (termEnum != null) {]
> [>                SegmentMergeInfo smi = new 
> SegmentMergeInfo(starts[i],
> termEnum, reader);]
> [>                if (t == null ? smi.next() : 
> termEnum.term() != null)]
> [>                    queue.put(smi);				  //
> initialize queue]
> [>                else]
> [>                    smi.close();]
> [>            }]
> [>        }]
> 
> 
> [Index: TermInfosReader.java]
> [===================================================================]
> [RCS file:
> /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/Term
> InfosReader.ja
> va,v]
> [retrieving revision 1.1.1.1]
> [diff -r1.1.1.1 TermInfosReader.java]
> [217c217]
> [<     get(term);					  // 
> seek enum to
> term]
> [---]
> [>     if (get(term) == null) return null;	 // seek enum to term]
> 
> 
> Please let me know if you see a problem with the change.  
> Otherwise, I'll
> check it in tomorrow.
> 
> Thanks,
> Scott
> 

Mime
View raw message