The following error is being thrown when sonarQube analysis is done on my java project :
"Make sure this file handling is safe here".
The lines of code for which this error is being thrown are :
final String filePath = "<<dummy_file_path>>"; File file = new File(filePath);
I declared the variable name containing
final so that it cannot be modified. Also, I read the filePath variable value from a property file and avoided hard coding it. But still the same error is being thrown.
I am expecting a fix for the above specified piece of code such that after sonarQube analysis, an error wont be thrown for safe file handling.
Thanks in advance.