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

Erroneous String Compare #101

Closed
QiAnXinCodeSafe opened this issue Sep 3, 2019 · 1 comment
Closed

Erroneous String Compare #101

QiAnXinCodeSafe opened this issue Sep 3, 2019 · 1 comment

Comments

@QiAnXinCodeSafe
Copy link

if (message != LITERAL_VALUE_MESSAGE) {

Strings should be compared with the equals() method, not == or !=.

@kluever
Copy link
Member

kluever commented Sep 3, 2019

See the comment directly before that line:

Using "!=" is fast and sufficient here because the only real case this should be skipping
is when we called log(String) or log(), which should not result in a template being created.
DO NOT replace this with a string instance which can be interned, or use equals() here,
since that could mistakenly treat other calls to log(String, Object...) incorrectly.

@kluever kluever closed this as completed Sep 3, 2019
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

No branches or pull requests

2 participants