[spotbugs] Fix potential NPE in FS.FileStoreAttributes#get
Path#getParent can return null, return fallback filestore attributes in that case. Change-Id: Ic09484d527bc87b27964b625e07373b82412f2da Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
d7b94f0194
commit
bceb202319
|
@ -337,6 +337,9 @@ public static FileStoreAttributes get(Path path) {
|
|||
try {
|
||||
path = path.toAbsolutePath();
|
||||
Path dir = Files.isDirectory(path) ? path : path.getParent();
|
||||
if (dir == null) {
|
||||
return FALLBACK_FILESTORE_ATTRIBUTES;
|
||||
}
|
||||
FileStoreAttributes cached = attrCacheByPath.get(dir);
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
|
|
Loading…
Reference in New Issue