Skip to content
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

Crash Fix: Handle PatternSyntaxException gracefully #1342

Merged
merged 1 commit into from
Feb 9, 2025

Conversation

iamarjun
Copy link
Contributor

@iamarjun iamarjun commented Feb 8, 2025

The indicesOf function in SearchHighlightUtil is refactored to use Pattern.quote for the search input. This ensures that any special characters in the search string are treated as literals, preventing potential PatternSyntaxException. In case a pattern cannot be compiled due to an invalid syntax a warning will be displayed in the logger and an empty list will be returned. Also we ensure the list is converted to immutable list to prevent unwanted modifications.

Fixes #1341

The `indicesOf` function in `SearchHighlightUtil` is refactored to use `Pattern.quote` for the search input. This ensures that any special characters in the search string are treated as literals, preventing potential `PatternSyntaxException`. In case a pattern cannot be compiled due to an invalid syntax a warning will be displayed in the logger and an empty list will be returned. Also we ensure the list is converted to immutable list to prevent unwanted modifications.
@iamarjun iamarjun requested a review from a team as a code owner February 8, 2025 14:24
@cortinico cortinico merged commit 309efa1 into ChuckerTeam:main Feb 9, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In Chucker, when I go to any response and in search box I type: {" then it crashes and also the app crashes.
2 participants