uschindler commented on PR #15900:
URL: https://github.com/apache/lucene/pull/15900#issuecomment-4178531177

   > > This code catches the `IndexOutOfBoundsException` as this is cheaper 
than validating the arguments first (it may happen that the term only consists 
of surrogates and its utf16 length is larger than the maximum length.
   > 
   > +1
   > 
   > But can we shrink wrap the `try`/`except` (move 
`termAttribute.setLength(truncateAtChar);` out)? It doesn't throw `IOOBE` right?
   
   Yes we can, but as the setLength does not throw it wont hurt. Moving it 
outside would require some reshuffling of the code and the variable...
   
   Lets discuss this. I also have a test with random data now, passes.


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