aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/files/LocalStorage.java
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-08-18 19:08:39 +0200
committerBananeweizen <bananeweizen@gmx.de>2013-08-18 19:08:39 +0200
commitcd03c1b91da2b5c8cc7eb4f5617263c6aebcbd21 (patch)
treecc37d7e3f9f2805992b320169c0e71cf07f6dc1d /main/src/cgeo/geocaching/files/LocalStorage.java
parente3bad494f541eb574e80e466ed8abaef8bb5d257 (diff)
downloadcgeo-cd03c1b91da2b5c8cc7eb4f5617263c6aebcbd21.zip
cgeo-cd03c1b91da2b5c8cc7eb4f5617263c6aebcbd21.tar.gz
cgeo-cd03c1b91da2b5c8cc7eb4f5617263c6aebcbd21.tar.bz2
refactoring: more findbugs cleanup
Diffstat (limited to 'main/src/cgeo/geocaching/files/LocalStorage.java')
-rw-r--r--main/src/cgeo/geocaching/files/LocalStorage.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/files/LocalStorage.java b/main/src/cgeo/geocaching/files/LocalStorage.java
index 7657e1e..57f586e 100644
--- a/main/src/cgeo/geocaching/files/LocalStorage.java
+++ b/main/src/cgeo/geocaching/files/LocalStorage.java
@@ -167,7 +167,7 @@ public final class LocalStorage {
private static File buildFile(final File base, final String fileName, final boolean isUrl, final boolean createDirs) {
if (createDirs) {
- base.mkdirs();
+ FileUtils.mkdirs(base);
}
return new File(base, isUrl ? CryptUtils.md5(fileName) + getExtension(fileName) : fileName);
}
@@ -287,7 +287,7 @@ public final class LocalStorage {
* @return true if the copy happened without error, false otherwise
*/
public static boolean copy(final File source, final File destination) {
- destination.getParentFile().mkdirs();
+ FileUtils.mkdirs(destination.getParentFile());
InputStream input = null;
OutputStream output = null;
@@ -296,9 +296,10 @@ public final class LocalStorage {
output = new BufferedOutputStream(new FileOutputStream(destination));
} catch (FileNotFoundException e) {
Log.e("LocalStorage.copy: could not open file", e);
+ return false;
+ } finally {
IOUtils.closeQuietly(input);
IOUtils.closeQuietly(output);
- return false;
}
boolean copyDone = copy(input, output);