[spotbugs]: Fix potential NPE in FileSnapshot constructor
File#getParent can return null which caused this spotbugs warning. FS.FileStoreAttributes#get already gets the parent directory if the passed File is not a directory and checks for null. Hence there is no need to get the parent directory in the FileSnapshot constructor. Change-Id: I77f71503cffb05970ab8d9ba55b69c96c53098b9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
877ce01d29
commit
ef04b3b883
|
@ -223,7 +223,7 @@ protected FileSnapshot(File file, boolean useConfig) {
|
|||
this.file = file;
|
||||
this.lastRead = Instant.now();
|
||||
this.fileStoreAttributeCache = useConfig
|
||||
? FS.getFileStoreAttributes(file.toPath().getParent())
|
||||
? FS.getFileStoreAttributes(file.toPath())
|
||||
: FALLBACK_FILESTORE_ATTRIBUTES;
|
||||
BasicFileAttributes fileAttributes = null;
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue