Browse Source

[findBugs] Fix potential NPE in CleanFilter

Change-Id: Ibc20e9fc16be62f61748b3f59f6d70c1ebf63671
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.7
Matthias Sohn 8 years ago
parent
commit
f211bfc841
  1. 5
      org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java

5
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java

@ -151,7 +151,10 @@ public class CleanFilter extends FilterCommand {
FileUtils.delete(tmpFile.toFile()); FileUtils.delete(tmpFile.toFile());
} }
} else { } else {
FileUtils.mkdirs(mediaFile.getParent().toFile(), true); Path parent = mediaFile.getParent();
if (parent != null) {
FileUtils.mkdirs(parent.toFile(), true);
}
FileUtils.rename(tmpFile.toFile(), mediaFile.toFile(), FileUtils.rename(tmpFile.toFile(), mediaFile.toFile(),
StandardCopyOption.ATOMIC_MOVE); StandardCopyOption.ATOMIC_MOVE);
} }

Loading…
Cancel
Save