summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2015-08-10 16:40:50 +0100
committerTorne (Richard Coles) <torne@google.com>2015-08-10 16:40:50 +0100
commitc52839277b8714d150a9fe276b6ba3fa8a0cbf38 (patch)
tree3f1e830a0fac29ea026f72a507d3c7ab173082f1 /core
parent4218e46a3263e5ed9d99e600ef9b30cbd24cc861 (diff)
downloadframeworks_base-c52839277b8714d150a9fe276b6ba3fa8a0cbf38.zip
frameworks_base-c52839277b8714d150a9fe276b6ba3fa8a0cbf38.tar.gz
frameworks_base-c52839277b8714d150a9fe276b6ba3fa8a0cbf38.tar.bz2
Close ZipFiles correctly in WebViewFactory.
We weren't closing the ZipFiles created in WebViewFactory to check inside APKs - use try-with-resources to get them closed automatically. Bug: 23072621 Change-Id: I11c6b77e960a7d240d19d22240cac177b6ba27b2
Diffstat (limited to 'core')
-rw-r--r--core/java/android/webkit/WebViewFactory.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/core/java/android/webkit/WebViewFactory.java b/core/java/android/webkit/WebViewFactory.java
index 3b9aca8..584deff 100644
--- a/core/java/android/webkit/WebViewFactory.java
+++ b/core/java/android/webkit/WebViewFactory.java
@@ -314,8 +314,7 @@ public final class WebViewFactory {
if (path.contains("!/")) {
String[] split = TextUtils.split(path, "!/");
if (split.length == 2) {
- try {
- ZipFile z = new ZipFile(split[0]);
+ try (ZipFile z = new ZipFile(split[0])) {
ZipEntry e = z.getEntry(split[1]);
if (e != null && e.getMethod() == ZipEntry.STORED) {
newVmSize = Math.max(newVmSize, e.getSize());
@@ -355,8 +354,7 @@ public final class WebViewFactory {
String[] abiList,
String nativeLibFileName) {
// Search the APK for a native library conforming to a listed ABI.
- try {
- ZipFile z = new ZipFile(apkPath);
+ try (ZipFile z = new ZipFile(apkPath)) {
for (String abi : abiList) {
final String entry = "lib/" + abi + "/" + nativeLibFileName;
ZipEntry e = z.getEntry(entry);