You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2021/11/18 18:37:28 UTC

[lucenenet] branch master updated: BUG: Lucene.Net.Codecs.SimpleText.SimpleTextFieldsReader::NextDoc(): Assert was using BytesRef.Utf8ToString(), which was causing exceptions when the BytesRef didn't contain valid UTF8. Changed to use BytesRefFormatter, which defers the call to convert the BytesRef until after the assert fails.

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git


The following commit(s) were added to refs/heads/master by this push:
     new 1383437  BUG: Lucene.Net.Codecs.SimpleText.SimpleTextFieldsReader::NextDoc(): Assert was using BytesRef.Utf8ToString(), which was causing exceptions when the BytesRef didn't contain valid UTF8. Changed to use BytesRefFormatter, which defers the call to convert the BytesRef until after the assert fails.
1383437 is described below

commit 1383437a6684ab21871884e6f49b4a0e7a592085
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Nov 17 00:36:25 2021 +0700

    BUG: Lucene.Net.Codecs.SimpleText.SimpleTextFieldsReader::NextDoc(): Assert was using BytesRef.Utf8ToString(), which was causing exceptions when the BytesRef didn't contain valid UTF8. Changed to use BytesRefFormatter, which defers the call to convert the BytesRef until after the assert fails.
---
 src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
index b85f22c..ab7d01f 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
@@ -311,7 +311,7 @@ namespace Lucene.Net.Codecs.SimpleText
                     {
                         if (Debugging.AssertsEnabled) Debugging.Assert(
                             StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.TERM) || StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.FIELD) ||
-                            StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.END), "scratch={0}", _scratch.Utf8ToString());
+                            StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.END), "scratch={0}", new BytesRefFormatter(_scratch, BytesRefFormat.UTF8));
 
                         if (!first && (_liveDocs == null || _liveDocs.Get(_docId)))
                         {