Remove android.util.Log from FileUtils

FileUtils is being used for other non android projects
and hence breaks when built. Instead use the log statements
at caller to record Log.e messages. Hence there is no side
effect here.

Bug:22042371
Change-Id: Ieb100006ff38e013bc30542637465f58bfc0f2f2
main
Jatin Matani 2015-07-09 11:50:10 -07:00
parent 8c2591eec8
commit d711426a87
3 changed files with 9 additions and 10 deletions

View File

@ -16,8 +16,6 @@
package com.android.inputmethod.latin.common;
import android.util.Log;
import java.io.File;
import java.io.FilenameFilter;
@ -58,11 +56,6 @@ public class FileUtils {
public static boolean renameTo(final File fromFile, final File toFile) {
toFile.delete();
final boolean success = fromFile.renameTo(toFile);
if (!success) {
Log.e(TAG, String.format("Failed to rename from %s to %s.",
fromFile.getAbsoluteFile(), toFile.getAbsoluteFile()));
}
return success;
return fromFile.renameTo(toFile);
}
}

View File

@ -324,7 +324,10 @@ public final class BinaryDictionaryFileDumper {
// move the output file to the final staging file.
final File finalFile = new File(finalFileName);
FileUtils.renameTo(outputFile, finalFile);
if (!FileUtils.renameTo(outputFile, finalFile)) {
Log.e(TAG, String.format("Failed to rename from %s to %s.",
outputFile.getAbsoluteFile(), finalFile.getAbsoluteFile()));
}
wordListUriBuilder.appendQueryParameter(QUERY_PARAMETER_DELETE_RESULT,
QUERY_PARAMETER_SUCCESS);

View File

@ -314,7 +314,10 @@ public class DictionaryInfoUtils {
final String cacheFilename = cacheDirectoryForLocale + File.separator + fileId;
final File cacheFile = new File(cacheFilename);
// move the staging file to cache file.
FileUtils.renameTo(stagingFile, cacheFile);
if (!FileUtils.renameTo(stagingFile, cacheFile)) {
Log.e(TAG, String.format("Failed to rename from %s to %s.",
stagingFile.getAbsoluteFile(), cacheFile.getAbsoluteFile()));
}
}
}
}