diff options
author | Doug Zongker <dougz@android.com> | 2011-11-04 13:39:47 -0700 |
---|---|---|
committer | Doug Zongker <dougz@android.com> | 2011-11-04 14:11:12 -0700 |
commit | e2d58e95a09590a63f1c597bb808b925bcab9a69 (patch) | |
tree | 023d0317ca5e6f6d25d9f9f914b8836978539d09 | |
parent | 7b95eba9f47a3992128d59a9ec593b887e4dac0e (diff) | |
download | frameworks_base-e2d58e95a09590a63f1c597bb808b925bcab9a69.zip frameworks_base-e2d58e95a09590a63f1c597bb808b925bcab9a69.tar.gz frameworks_base-e2d58e95a09590a63f1c597bb808b925bcab9a69.tar.bz2 |
close input streams obtained from otacerts zip file
Quells a StrictMode warning from OTA verification.
Change-Id: Ie3e4c345551d1925fcc37c3ae9ce5c45713be93a
-rw-r--r-- | core/java/android/os/RecoverySystem.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index 73e8d98..43cf74e 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -26,6 +26,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; +import java.io.InputStream; import java.io.RandomAccessFile; import java.security.GeneralSecurityException; import java.security.PublicKey; @@ -103,7 +104,12 @@ public class RecoverySystem { Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); - trusted.add(cf.generateCertificate(zip.getInputStream(entry))); + InputStream is = zip.getInputStream(entry); + try { + trusted.add(cf.generateCertificate(is)); + } finally { + is.close(); + } } } finally { zip.close(); @@ -162,8 +168,6 @@ public class RecoverySystem { int commentSize = (footer[4] & 0xff) | ((footer[5] & 0xff) << 8); int signatureStart = (footer[0] & 0xff) | ((footer[1] & 0xff) << 8); - Log.v(TAG, String.format("comment size %d; signature start %d", - commentSize, signatureStart)); byte[] eocd = new byte[commentSize + 22]; raf.seek(fileLen - (commentSize + 22)); |