lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Ganyo <scott.ga...@eTapestry.com>
Subject RE: Proposed changes to SegmentsReader and TermInfosReader
Date Wed, 10 Oct 2001 19:24:19 GMT
Sorry about the confusion, I'll fix up my diffs in the future.

Anyway, I'm not convinced that this is a non-risky change.  The reason being
that the one-line change in the TermInfosReader will now allow a null to be
passed back from the method where none was expected.  Instead, I'll propose
a different fix...

The original problem was that SegmentTermEnum.java:51 was getting a
NullPointerException because the term was null.  So now instead of passing a
null up the chain, I'd like to instead make the SegmentTermEnum clone() work
regardless of the Term being null.  I think the only change that needs to be
done then is to make this change:

Index: SegmentTermEnum.java
===================================================================
RCS file:
/home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/SegmentTermEnum.ja
va,v
retrieving revision 1.1.1.1
diff -u -w -r1.1.1.1 SegmentTermEnum.java
--- SegmentTermEnum.java	2001/09/18 16:29:54	1.1.1.1
+++ SegmentTermEnum.java	2001/10/10 19:14:54
@@ -88,7 +88,7 @@
 
     clone.input = (InputStream)input.clone();
     clone.termInfo = new TermInfo(termInfo);
-    clone.growBuffer(term.text.length());
+    if (term != null) clone.growBuffer(term.text.length());
 
     return clone;
   }

This seems much safer to me as the resulting enum will be valid, but empty.

Scott

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message