Skip to content

Avoid Pattern compilation - #2489

Merged
easbar merged 3 commits into
graphhopper:masterfrom
otbutz:improve_escaping
Apr 2, 2022
Merged

easbar merged 3 commits into
graphhopper:masterfrom
otbutz:improve_escaping

Conversation

@otbutz

@otbutz otbutz commented Dec 10, 2021

Copy link
Copy Markdown
Contributor

The old code would need to compile two Pattern instance for each call of simpleXMLEscape() as String.replaceAll() requires that a Pattern is compiled on each call. The PR switches one of the replaceAll() calls to a simple replace() as it doesn't require regex functionality. The other one is compiled once and gets reused.

@karussell

Copy link
Copy Markdown
Member

Did you have a problem in production due to this?

The PR switches one of the replaceAll() calls to a simple replace() as it doesn't require regex functionality.

👍

@otbutz

otbutz commented Dec 10, 2021

Copy link
Copy Markdown
Contributor Author

Just Sonarlint screaming on top of its lungs 😄

@otbutz

otbutz commented Dec 22, 2021

Copy link
Copy Markdown
Contributor Author

Any objections?

@easbar
easbar merged commit 8515ad4 into graphhopper:master Apr 2, 2022
@easbar

easbar commented Apr 2, 2022

Copy link
Copy Markdown
Member

Thanks

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.

3 participants