mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 738421 - Close zip when done reading. r=sriram
This commit is contained in:
parent
0a128bef50
commit
63a240359f
@ -297,14 +297,19 @@ public class Favicons {
|
||||
} catch (Exception e) {
|
||||
// Trying to read icons from nested jar files will fail
|
||||
if (mFaviconUrl.startsWith("jar:jar:")) {
|
||||
InputStream stream = GeckoJarReader.getStream(mFaviconUrl);
|
||||
if (stream != null) {
|
||||
image = new BitmapDrawable(stream);
|
||||
} else {
|
||||
Log.d(LOGTAG, "Error getting favicon from jar: " + e);
|
||||
try {
|
||||
InputStream stream = GeckoJarReader.getStream(mFaviconUrl);
|
||||
if (stream != null) {
|
||||
image = new BitmapDrawable(stream);
|
||||
stream.close();
|
||||
} else {
|
||||
Log.d(LOGTAG, "Error getting favicon from jar: " + e);
|
||||
}
|
||||
} catch(IOException ex) {
|
||||
Log.e(LOGTAG, "Error closing stream", ex);
|
||||
}
|
||||
} else {
|
||||
Log.d(LOGTAG, "Error downloading favicon: " + e);
|
||||
Log.e(LOGTAG, "Error downloading favicon", e);
|
||||
}
|
||||
} finally {
|
||||
if (urlConnection != null && urlConnection instanceof HttpURLConnection) {
|
||||
|
@ -26,11 +26,12 @@ public class GeckoJarReader {
|
||||
Stack<String> jarUrls = parseUrl(url);
|
||||
ZipInputStream inputStream = null;
|
||||
|
||||
ZipFile zip = null;
|
||||
try {
|
||||
// Load the initial jar file as a zip
|
||||
URL fileUrl = new URL(jarUrls.pop());
|
||||
File file = new File(fileUrl.getPath());
|
||||
ZipFile zip = new ZipFile(file);
|
||||
zip = new ZipFile(file);
|
||||
ZipEntry entry = null;
|
||||
|
||||
// loop through children jar files until we reach the innermost one
|
||||
@ -63,6 +64,14 @@ public class GeckoJarReader {
|
||||
Log.e(LOGTAG, "Exception ", ex);
|
||||
} catch (Exception ex) {
|
||||
Log.e(LOGTAG, "Exception ", ex);
|
||||
} finally {
|
||||
if (zip != null) {
|
||||
try {
|
||||
zip.close();
|
||||
} catch(IOException ex) {
|
||||
Log.e(LOGTAG, "Error closing zip", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return inputStream;
|
||||
|
Loading…
Reference in New Issue
Block a user