aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Moesch <florian@moesch.org>2011-08-11 13:58:51 +0200
committerFlorian Moesch <florian@moesch.org>2011-08-11 13:58:51 +0200
commit80ad4122acf199454342d8fb5703b374b3e17a4a (patch)
treece2d742e85b4cd5f40ad58214992c406f80b8b7e
parent323d4cf75ef7da484d93d2298c7051fdbdaaa3fe (diff)
downloadcgeo-80ad4122acf199454342d8fb5703b374b3e17a4a.zip
cgeo-80ad4122acf199454342d8fb5703b374b3e17a4a.tar.gz
cgeo-80ad4122acf199454342d8fb5703b374b3e17a4a.tar.bz2
resource leaks (files did not get closed in case of io exceptions during flush)
-rw-r--r--src/cgeo/geocaching/cgDirectionImg.java2
-rw-r--r--src/cgeo/geocaching/cgHtmlImg.java2
-rw-r--r--src/cgeo/geocaching/cgMapImg.java2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/cgeo/geocaching/cgDirectionImg.java b/src/cgeo/geocaching/cgDirectionImg.java
index 52ff7f3..f9227b2 100644
--- a/src/cgeo/geocaching/cgDirectionImg.java
+++ b/src/cgeo/geocaching/cgDirectionImg.java
@@ -73,11 +73,11 @@ public class cgDirectionImg {
fos.write(buffer, 0, l);
}
ok = true;
+ fos.flush();
} catch (IOException e) {
Log.e(cgSettings.tag, "cgDirectionImg.getDrawable (saving to cache): " + e.toString());
} finally {
is.close();
- fos.flush();
fos.close();
}
}
diff --git a/src/cgeo/geocaching/cgHtmlImg.java b/src/cgeo/geocaching/cgHtmlImg.java
index 36fc1fc..f3e9f20 100644
--- a/src/cgeo/geocaching/cgHtmlImg.java
+++ b/src/cgeo/geocaching/cgHtmlImg.java
@@ -230,11 +230,11 @@ public class cgHtmlImg implements Html.ImageGetter {
while ((l = is.read(buffer)) != -1) {
fos.write(buffer, 0, l);
}
+ fos.flush();
} catch (IOException e) {
Log.e(cgSettings.tag, "cgHtmlImg.getDrawable (saving to cache): " + e.toString());
} finally {
is.close();
- fos.flush();
fos.close();
}
}
diff --git a/src/cgeo/geocaching/cgMapImg.java b/src/cgeo/geocaching/cgMapImg.java
index 207971a..1ab8cdb 100644
--- a/src/cgeo/geocaching/cgMapImg.java
+++ b/src/cgeo/geocaching/cgMapImg.java
@@ -86,12 +86,12 @@ public class cgMapImg {
fos.write(buffer, 0, bytesRead);
fileSize += bytesRead;
}
+ fos.flush();
ok = true;
} catch (IOException e) {
Log.e(cgSettings.tag, "cgMapImg.getDrawable (saving to cache): " + e.toString());
} finally {
is.close();
- fos.flush();
fos.close();
}