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

Optimize regex in trimAdjacentBlankLines() method of ExtractedTextFormatter to prevent stack overflow #2248

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

solenyk
Copy link

@solenyk solenyk commented Feb 14, 2025

These changes were made to close issue 2247. The optimized regular expression works even with files containing 1500+ empty lines (I tested on files up to 2000 empty lines) on VM settings -Xss256k.

I also removed the final keyword from the class declaration because I see cases for its inheritance (for example, right now I was forced to copy the entire class in order to rewrite the regex for my code).

@solenyk solenyk force-pushed the bugfix/optimize-extracted-text-formatter-trim-regex branch 2 times, most recently from 2572e69 to 9bcd4cc Compare February 14, 2025 16:44
…matter to prevent stack overflow

Closes 2247 issue

Signed-off-by: Iryna Kopchak <[email protected]>
@solenyk solenyk force-pushed the bugfix/optimize-extracted-text-formatter-trim-regex branch from 9bcd4cc to 48900fd Compare February 14, 2025 16:47
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.

Stack overflow exception in trimAdjacentBlankLines() method due to inefficient regex in ExtractedTextFormatter
1 participant