You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Yannick Welsch (Jira)" <ji...@apache.org> on 2022/03/18 07:44:00 UTC

[jira] [Created] (LUCENE-10474) Avoid throwing StackOverflowError when creating RegExp

Yannick Welsch created LUCENE-10474:
---------------------------------------

             Summary: Avoid throwing StackOverflowError when creating RegExp
                 Key: LUCENE-10474
                 URL: https://issues.apache.org/jira/browse/LUCENE-10474
             Project: Lucene - Core
          Issue Type: Improvement
          Components: core/other
            Reporter: Yannick Welsch


Creating a regular expression using Lucene's RegExp class can easily result in a StackOverflowError being thrown, for example when the input is larger than the maximum stack depth. Throwing a StackOverflowError isn't something a user would expect, and it isn't documented either. StackOverflowError is a user-unfriendly exception as it does not convey any intent that the user has done something wrong, but suggests a bug in the implementation.

I would like Lucene to follow the [approach taken by the JDK|https://github.com/openjdk/jdk/blob/cab4ff64541393a974ea91e35167668ef0036804/src/java.base/share/classes/java/util/regex/Pattern.java#L1441] and throw an IllegalArgumentException instead to clearly mark this as an input that the implementation can't handle.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org