Java
Mismatched case in 'String' operation
Warning
Reliability
New
CWE-597
Last modified: 03 December 2024 Reports String
method calls that always return the same value (-1
or false
) because a lowercase character is searched in an uppercase-only string or vice versa.
Reported methods include equals
, startsWith
, endsWith
, contains
, indexOf
, and lastIndexOf
.
Example:
if (columnName.toLowerCase().equals("ID")) {...}
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
MismatchedStringCase
New in 2019.3
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Java, 243.23126 |
Thanks for your feedback!
Was this page helpful?