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

[Enhancement] Do some code optimization.[CloudEventUtils] #3829

Closed
1 of 2 tasks
Alonexc opened this issue Apr 27, 2023 · 0 comments · Fixed by #3860
Closed
1 of 2 tasks

[Enhancement] Do some code optimization.[CloudEventUtils] #3829

Alonexc opened this issue Apr 27, 2023 · 0 comments · Fixed by #3860
Labels
enhancement New feature or request

Comments

@Alonexc
Copy link
Contributor

Alonexc commented Apr 27, 2023

Search before asking

  • I had searched in the issues and found no similar issues.

Enhancement Request

image
image
located at:
eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/utils/CloudEventUtils.java line 88,128
analysis and explanation:
a. The underlying implementation of String::replaceAll calls the java.util.regex.Pattern.compile() method each time it is called even if the first argument is not a regular expression. This has a significant performance cost and therefore should be used with care.
When String::replaceAll is used, the first argument should be a real regular expression. If it’s not the case, String::replace does exactly the same thing as String::replaceAll without the performance drawback of the regex.
b. This method prints a stack trace to the console. This is non configurable, and causes an application to look unprofessional.

Describe the solution you'd like

a.Replace with replace().
image

b. Remove e.printStackTrace().

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant