jpountz commented on code in PR #12987:
URL: https://github.com/apache/lucene/pull/12987#discussion_r1448975940


##########
lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextDocValuesReader.java:
##########
@@ -329,9 +330,15 @@ public BytesRef apply(int docID) {
               } catch (ParseException pe) {
                 throw new CorruptIndexException("failed to parse int length", 
in, pe);
               }
-              term.grow(len);
-              term.setLength(len);
-              in.readBytes(term.bytes(), 0, len);
+              termByteArray.grow(len);
+              termByteArray.setLength(len);
+              in.readBytes(termByteArray.bytes(), 0, len);
+              if (len > 2) {
+                term.copyBytes(
+                    
SimpleTextUtil.fromBytesRefString(termByteArray.get().utf8ToString()));
+              } else {
+                term.setLength(0);
+              }

Review Comment:
   Why do we need this condition? Can't `fromBytesRefString` read empty arrays?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to