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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to