[spotbugs] Fix potential NPE in FS#write
Path#getParent can return null. Change-Id: I01f13ac426dda4c007cc5caab546a0c9be62ce76 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
1ed6353962
commit
23bc9dc71d
|
@ -511,7 +511,10 @@ private static Duration measureMinimalRacyInterval(Path dir) {
|
|||
}
|
||||
|
||||
private static void write(Path p, String body) throws IOException {
|
||||
FileUtils.mkdirs(p.getParent().toFile(), true);
|
||||
Path parent = p.getParent();
|
||||
if (parent != null) {
|
||||
FileUtils.mkdirs(parent.toFile(), true);
|
||||
}
|
||||
try (Writer w = new OutputStreamWriter(Files.newOutputStream(p),
|
||||
UTF_8)) {
|
||||
w.write(body);
|
||||
|
|
Loading…
Reference in New Issue