Inspectopedia
 
2024.3

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")) {...}

New in 2019.3