Deprecate redundant FileUtil.delete(File), use FileUtils instead
Bug: 475070
Change-Id: I6dc651f4b47e1b2c8d7954ec982e21ae6bb5f7a6
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
index 6ce348c..4d34394 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
@@ -285,9 +285,7 @@
* @since 3.3
*/
public void delete(File f) throws IOException {
- if (!f.delete())
- throw new IOException(MessageFormat.format(
- JGitText.get().deleteFileFailed, f.getAbsolutePath()));
+ FileUtils.delete(f);
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
index 22c1abd..2cd82df 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
@@ -261,11 +261,6 @@
}
@Override
- public void delete(File path) throws IOException {
- FileUtil.delete(path);
- }
-
- @Override
public long length(File f) throws IOException {
return FileUtil.getLength(f);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java
index 8ff274e..987046c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java
@@ -199,11 +199,6 @@
}
@Override
- public void delete(File path) throws IOException {
- FileUtil.delete(path);
- }
-
- @Override
public long length(File f) throws IOException {
return FileUtil.getLength(f);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java
index 6c5e73d..7933dcd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java
@@ -184,11 +184,6 @@
}
@Override
- public void delete(File path) throws IOException {
- FileUtil.delete(path);
- }
-
- @Override
public long length(File f) throws IOException {
return FileUtil.getLength(f);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtil.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtil.java
index 5dfba4a..fd53a95 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtil.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtil.java
@@ -193,10 +193,11 @@
/**
* @param path
* @throws IOException
+ * @deprecated use {@link FileUtils#delete(File)}
*/
+ @Deprecated
public static void delete(File path) throws IOException {
- Path nioPath = path.toPath();
- Files.delete(nioPath);
+ FileUtils.delete(path);
}
static Attributes getFileAttributesBasic(FS fs, File path) {