public Solution(String pathToFile) {
Path path = Paths.get(pathToFile);
try {
boolean isHiden = Files.isHidden(path);
boolean isExecutable = Files.isExecutable(path);
boolean isDirectory = Files.isDirectory(path);
boolean isWritable = Files.isWritable(path);
fileData = new ConcreteFileData(isHiden, isExecutable,isDirectory,isWritable);
} catch (Exception e) {
fileData = new NullFileData(e);
}
}
any improve for this?
Under discussion
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Michał
2 August 2020, 17:39
I think that "path" variable should be also included in try/catch block, because it might result in NullPointerException.
+2