I have batch writer class to get the files from the directory but getting the CWE 73 flaw in the below mentioned line. is anyone have a solution to mitigate this flaw?
this.Dir - this is the DB property name to get the path from DB.
String filePath;
File folder=new File(this.Dir); //CWE 73 flaw detected
File[] listOfFiles = folder.listFiles();
if (null != listOfFiles && listOfFiles.length > 0) {
for (File file : listOfFiles) {
if (listOfFiles.length > 1)
filePath = file.getAbsolutePath();
I gone through the below veracode documentation but still i am not getting possible fix for above mentioned code.