danmuzi commented on a change in pull request #767: LUCENE-8904: enhance Nori 
DictionaryBuilder tool
URL: https://github.com/apache/lucene-solr/pull/767#discussion_r301171182
 
 

 ##########
 File path: 
lucene/analysis/nori/src/tools/java/org/apache/lucene/analysis/ko/util/BinaryDictionaryWriter.java
 ##########
 @@ -137,14 +139,17 @@ public int put(String[] entry) {
       flags |= BinaryDictionary.HAS_READING;
     }
 
-    assert leftId < 8192; // there are still unused bits
-    assert posType.ordinal() < 4;
+    if (leftId >= ID_LIMIT) {
+      throw new IllegalArgumentException("leftId >= " + ID_LIMIT + ": " + 
leftId);
+    }
+    if (posType.ordinal() >= 4) {
+      throw new IllegalArgumentException("posType.ordinal() >= " + 4 + ": " + 
posType.ordinal());
 
 Review comment:
   +1.
   
   Which log style is better?
   1) `throw new IllegalArgumentException("posType.ordinal() >= " + 4 + ": " + 
posType.name());`
   2) `throw new IllegalArgumentException("posType should be MORPHOME or 
COMPOUND or INFLECT or PREANALYSIS" + ": " + posType.name());`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to