]> source.dussan.org Git - jgit.git/commitdiff
Deprecate redundant FileUtil.delete(File), use FileUtils instead 37/53837/7
authorAndrey Loskutov <loskutov@gmx.de>
Sun, 16 Aug 2015 16:15:30 +0000 (18:15 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Wed, 26 Aug 2015 21:25:38 +0000 (23:25 +0200)
Bug: 475070
Change-Id: I6dc651f4b47e1b2c8d7954ec982e21ae6bb5f7a6
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java
org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtil.java

index 6ce348c1bedddbdae163a81cf55d7c9678ffa3fa..4d34394ba059d972d12e46fdb46e2a36a00f5312 100644 (file)
@@ -285,9 +285,7 @@ public abstract class FS {
         * @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);
        }
 
        /**
index 22c1abd7d9c61c44ed75cf87d13339fe31fc1e57..2cd82df34f3b372194882cf80b50a70f12daf923 100644 (file)
@@ -260,11 +260,6 @@ public class FS_POSIX extends FS {
                FileUtil.setLastModified(path, time);
        }
 
-       @Override
-       public void delete(File path) throws IOException {
-               FileUtil.delete(path);
-       }
-
        @Override
        public long length(File f) throws IOException {
                return FileUtil.getLength(f);
index 8ff274e1091a975e5a8084b82c4164e61213bee9..987046cbffd7e88c45e7ae609ba52e812474a975 100644 (file)
@@ -198,11 +198,6 @@ public class FS_Win32 extends FS {
                FileUtil.setLastModified(path, time);
        }
 
-       @Override
-       public void delete(File path) throws IOException {
-               FileUtil.delete(path);
-       }
-
        @Override
        public long length(File f) throws IOException {
                return FileUtil.getLength(f);
index 6c5e73d051c9c3890fd11715600e87a44bfb46c2..7933dcd3140d59429a39f50d564f39785fbe3f69 100644 (file)
@@ -183,11 +183,6 @@ public class FS_Win32_Cygwin extends FS_Win32 {
                FileUtil.setLastModified(path, time);
        }
 
-       @Override
-       public void delete(File path) throws IOException {
-               FileUtil.delete(path);
-       }
-
        @Override
        public long length(File f) throws IOException {
                return FileUtil.getLength(f);
index 5dfba4ac4ac82ffd881a0905e431566b453e4d1f..fd53a95b5a7cd2c2f48770705958ab49a57febb8 100644 (file)
@@ -193,10 +193,11 @@ public class FileUtil {
        /**
         * @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) {