close streams when done
found by findbugs
http://b/issue?id=1856630
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 769f54d..5c4a63d 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -431,16 +431,34 @@
* BUILD_INFOS_FILE in the plugins directory.
*/
public void copyBuildInfos() {
+ FileInputStream iStream = null;
+ FileOutputStream oStream = null;
try {
if (LOGV_ENABLED) {
Log.v(TAG, "Copy build infos to the plugins directory");
}
File buildInfoFile = new File(SYSTEM_BUILD_INFOS_FILE);
File buildInfoPlugins = new File(pluginsPath, BUILD_INFOS_FILE);
- copyStreams(new FileInputStream(buildInfoFile),
- new FileOutputStream(buildInfoPlugins));
+ iStream = new FileInputStream(buildInfoFile);
+ oStream = new FileOutputStream(buildInfoPlugins);
+ copyStreams(iStream, oStream);
} catch (IOException e) {
Log.e(TAG, "Exception while copying the build infos: " + e);
+ } finally {
+ try {
+ if (iStream != null) {
+ iStream.close();
+ }
+ } catch (IOException e2) {
+ Log.e(TAG, "Exception while closing the input stream: " + e2);
+ }
+ try {
+ if (oStream != null) {
+ oStream.close();
+ }
+ } catch (IOException e3) {
+ Log.e(TAG, "Exception while closing the output stream: " + e3);
+ }
}
}