Closed VladOsipov closed 4 years ago
And I didn't find any place where you use the result of this method. Why isn't it void ?
Also, please take a look at this code blocks
coachFile = new File(dirPath + File.separator + "coachList.txt");
if (!coachFile.exists()) {
try {
created = coachFile.createNewFile();
} catch (IOException e) {
System.err.println("FileConfigurator.fileExist(); Coach file cannot be created");
e.printStackTrace();
}
}
sportsmenFile = new File(dirPath + File.separator + "sportsmenList.txt");
if (!sportsmenFile.exists()) {
try {
created = sportsmenFile.createNewFile();
} catch (IOException e) {
System.err.println("FileConfigurator.fileExist(); Coach file cannot be created");
e.printStackTrace();
}
}
allUsersFile = new File(dirPath + File.separator + "allUsersFileList.txt");
if (!allUsersFile.exists()) {
try {
created = allUsersFile.createNewFile();
} catch (IOException e) {
System.err.println("FileConfigurator.fileExist(); Coach file cannot be created");
e.printStackTrace();
}
}
What do you think about this blocks?
Done.
The method below looks loke it checks if file exists and return the result of this check. But inside this method you create files (it's not expected)