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

LGTM.com - false positive: Java variable cant be null after !Strings.isNullOrEmpty check #4355

Closed
XN137 opened this issue Sep 28, 2020 · 1 comment · Fixed by #4383
Closed

Comments

@XN137
Copy link

XN137 commented Sep 28, 2020

Description of the false positive

if (!Strings.isNullOrEmpty(ks) && !Strings.isNullOrEmpty(cf))
{
    String type = cf.contains(".") ? "IndexTable" : "Table";
    ...
}

inside the block cf can not be null, due to the if condition above.

URL to the alert on the project page on LGTM.com

https://lgtm.com/projects/g/apache/cassandra/snapshot/432180c435acbf284b835addb738df1510da5909/files/src/java/org/apache/cassandra/tools/NodeProbe.java#xa4c110c51a74e3d8:1

@aschackmull
Copy link
Contributor

Indeed, and thank you for the report. We currently don't model com.google.common.base.Strings.isNullOrEmpty, so that is why this guard currently isn't recognised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants