Browse Source

[findBugs] Prevent potential NPE in FileLfsRepository.getOutputStream()

Change-Id: I6f91997e8a976e5f4ace91c082d8b9adf1451adc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.5
Matthias Sohn 8 years ago
parent
commit
bfebe6ae4b
  1. 5
      org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java

5
org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java

@ -147,7 +147,10 @@ public class FileLfsRepository implements LargeFileRepository {
AtomicObjectOutputStream getOutputStream(AnyLongObjectId id) AtomicObjectOutputStream getOutputStream(AnyLongObjectId id)
throws IOException { throws IOException {
Path path = getPath(id); Path path = getPath(id);
Files.createDirectories(path.getParent()); Path parent = path.getParent();
if (parent != null) {
Files.createDirectories(parent);
}
return new AtomicObjectOutputStream(path, id); return new AtomicObjectOutputStream(path, id);
} }

Loading…
Cancel
Save