queryparse throws different exceptions when clone() fails
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
### Description
I find that my code fails to handle the failures of clones, when clones happen in queryparser.
I notice that lucene hides CloneNotSupportedException, and throws RuntimeException. For example, CharArrayIterator has the following code:
`public CharArrayIterator clone() {
try {
return (CharArrayIterator) super.clone();
} catch (CloneNotSupportedException e) {
// CharacterIterator does not allow you to throw CloneNotSupported
throw new RuntimeException(e);
}
}`
Due to the above observation, my code catches RuntimeException, and analyzes its embedded CloneNotSupportedException, when it needs to handle the failures of clones.
However, when I start to call queryparser, I find it does not hide CloneNotSupportedException. As a result, my code fails to catch failed clones when calling queryparser.
Will lucene fix the problem? If not, I will have to update all my handling code.
### Version and environment details
_No response_
Contributor guide
Research direction
Start by reproducing a clone failure through queryparser and compare its exception behavior with CharArrayIterator, whose clone() example is included in the report. Trace the queryparser clone paths and identify the current exception boundary. Done means clone failures have consistent, documented handling and a regression test covers the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100