-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Improvement] Use of regex on error messages can be fragile in DorisExceptionConverter.java #3027
Comments
Hi, I want to contribute to this project |
Hi @vip955529, do you want to work on this issue? |
Hi, I want to work on this issue. |
@ashwin1596 Do you still want to work on this? |
I am a bit confused about the issue. We are using the error code for "Database already exists" defined as:
We only use Do you have any suggestions? |
The issue is that the regex used like this can cause issues. Can you find a simpler regex or another way of doing it? |
Would it be possible to store the error messages in a configuration file and use those for comparisons, instead of relying on regular expressions? This approach leverages a configuration file for error messages, enabling a more organized and maintainable way to handle and update error messages dynamically. |
That sounds a little too heavyweight to me. |
In that case, may I suggest using exact string matching for errors within the same file as an alternative to using regex? This approach is less resource-intensive and can provide a more straightforward solution for error handling, ensuring both efficiency and reliability. The only consideration is that someone will need to maintain and update the error messages in case there are any changes to the error messages thrown by the database. |
What would you like to be improved?
DorisExceptionConverter.java uses a DATABASE_ALREADY_EXISTS_PATTERN_STRING regex to check error messages for databases that already exist. There are several issues with this and regex can be fragile expensive or even a possible DOS vector
How should we improve?
If possible improve code to not use regexp for this error condition.
The text was updated successfully, but these errors were encountered: