uschindler commented on code in PR #12299:
URL: https://github.com/apache/lucene/pull/12299#discussion_r1196018225


##########
lucene/core/src/java/org/apache/lucene/analysis/WordlistLoader.java:
##########
@@ -117,7 +120,10 @@ public static CharArraySet getWordSet(Reader reader, 
String comment, CharArraySe
       String word = null;
       while ((word = br.readLine()) != null) {
         if (word.startsWith(comment) == false) {
-          result.add(word.trim());
+          word = word.trim();
+          // skip blank lines
+          if (word.length() == 0) continue;

Review Comment:
   Use `word.isEmpty()`.



##########
lucene/core/src/java/org/apache/lucene/analysis/WordlistLoader.java:
##########
@@ -53,7 +53,10 @@ public static CharArraySet getWordSet(Reader reader, 
CharArraySet result) throws
     try (BufferedReader br = getBufferedReader(reader)) {
       String word = null;
       while ((word = br.readLine()) != null) {
-        result.add(word.trim());
+        word = word.trim();
+        // skip blank lines
+        if (word.length() == 0) continue;

Review Comment:
   Use `word.isEmpty()`.



-- 
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