Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Strapetz2017-11-14 09:02:07 +0000
committerMarc Strapetz2017-11-14 09:07:37 +0000
commit9bb126d12d812bb791d8c2f8bf48b5edb25d34ad (patch)
tree39610bf5dc832d37cb2ab18ad8afd158a103decf /org.eclipse.jgit.lfs
parent4bdf0ec67978a0ac28fe40fd104736502f48fded (diff)
downloadjgit-9bb126d12d812bb791d8c2f8bf48b5edb25d34ad.tar.gz
jgit-9bb126d12d812bb791d8c2f8bf48b5edb25d34ad.tar.xz
jgit-9bb126d12d812bb791d8c2f8bf48b5edb25d34ad.zip
FileUtils.toPath to convert File to Path
When invoking File.toPath(), an (unchecked) InvalidPathException may be thrown which should be converted to a checked IOException. For now, we will replace File.toPath() by FileUtils.toPath() only for code which can already handle IOExceptions. Change-Id: I0f0c5fd2a11739e7a02071adae9a5550985d4df6 Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
Diffstat (limited to 'org.eclipse.jgit.lfs')
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java2
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java3
2 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java
index b78ee047e5..7b0e7ab4d9 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java
@@ -124,7 +124,7 @@ public class CleanFilter extends FilterCommand {
public CleanFilter(Repository db, InputStream in, OutputStream out)
throws IOException {
super(in, out);
- lfsUtil = new Lfs(db.getDirectory().toPath().resolve("lfs")); //$NON-NLS-1$
+ lfsUtil = new Lfs(FileUtils.toPath(db.getDirectory()).resolve("lfs")); //$NON-NLS-1$
Files.createDirectories(lfsUtil.getLfsTmpDir());
tmpFile = lfsUtil.createTmpFile();
this.aOut = new AtomicObjectOutputStream(tmpFile.toAbsolutePath());
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java
index 233247779d..6b1f68d405 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java
@@ -53,6 +53,7 @@ import org.eclipse.jgit.attributes.FilterCommandFactory;
import org.eclipse.jgit.attributes.FilterCommandRegistry;
import org.eclipse.jgit.lfs.lib.Constants;
import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.util.FileUtils;
/**
* Built-in LFS smudge filter
@@ -100,7 +101,7 @@ public class SmudgeFilter extends FilterCommand {
public SmudgeFilter(Repository db, InputStream in, OutputStream out)
throws IOException {
super(in, out);
- lfs = new Lfs(db.getDirectory().toPath().resolve(Constants.LFS));
+ lfs = new Lfs(FileUtils.toPath(db.getDirectory()).resolve(Constants.LFS));
LfsPointer res = LfsPointer.parseLfsPointer(in);
if (res != null) {
Path mediaFile = lfs.getMediaFile(res.getOid());

Back to the top