I have following piece of code:
/**
* Performs the filename extension check (command-line argument validity).
* @param valid True, if the check should be performed.
* @param filename File name to test.
* @return False, if the test was done and the filename does not end with
* ".xml". Value of valid otherwise.
*/
private boolean checkFileNameExtension(final boolean valid,
final String filename) {
boolean result = valid;
if (valid
&& !filename.toLowerCase(Locale.ENGLISH).endsWith(".xml")) {
this.logger.error("File doesn't have XML extension.");
result = false;
}
return result;
}
FindBugs complains about the toLowerCase
call:
[WARNING] FindBugs: L I Dm: Use of non-localized String.toUpperCase() or
String.toLowerCase() in [...]checkFileNameExtension(boolean, String)
How can I correctly fix that warning (the proper way), if I can be sure that all file names will always have names with Latin letters only?