Skip to content

Crash Fix: Handle PatternSyntaxException gracefully#1342

Merged
cortinico merged 1 commit into
ChuckerTeam:mainfrom
iamarjun:search_crash_fix_2
Feb 9, 2025
Merged

Crash Fix: Handle PatternSyntaxException gracefully#1342
cortinico merged 1 commit into
ChuckerTeam:mainfrom
iamarjun:search_crash_fix_2

Conversation

@iamarjun

@iamarjun iamarjun commented Feb 8, 2025

Copy link
Copy Markdown
Contributor

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