diff options
| author | 2010-11-23 10:14:29 -0800 | |
|---|---|---|
| committer | 2010-11-23 10:14:29 -0800 | |
| commit | 0dccd0f0dc519b1f39b31aae9378ea8835feb94a (patch) | |
| tree | 668ef2c19b27392816c153dfa8c3882ee7cbcbf6 | |
| parent | 693c99ffdca44336134be635677371ceac3fae4b (diff) | |
| parent | 0c8224000db6a3c876f1d3717975a22d10ecddec (diff) | |
Merge "CloseGuard cleanups."
| -rw-r--r-- | services/java/com/android/server/DropBoxManagerService.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/services/java/com/android/server/DropBoxManagerService.java b/services/java/com/android/server/DropBoxManagerService.java index 0e451459e0ec..0a28da7542f0 100644 --- a/services/java/com/android/server/DropBoxManagerService.java +++ b/services/java/com/android/server/DropBoxManagerService.java @@ -343,16 +343,17 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub { if ((entry.flags & DropBoxManager.IS_TEXT) != 0 && (doPrint || !doFile)) { DropBoxManager.Entry dbe = null; + InputStreamReader isr = null; try { dbe = new DropBoxManager.Entry( entry.tag, entry.timestampMillis, entry.file, entry.flags); if (doPrint) { - InputStreamReader r = new InputStreamReader(dbe.getInputStream()); + isr = new InputStreamReader(dbe.getInputStream()); char[] buf = new char[4096]; boolean newline = false; for (;;) { - int n = r.read(buf); + int n = isr.read(buf); if (n <= 0) break; out.append(buf, 0, n); newline = (buf[n - 1] == '\n'); @@ -376,6 +377,12 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub { Slog.e(TAG, "Can't read: " + entry.file, e); } finally { if (dbe != null) dbe.close(); + if (isr != null) { + try { + isr.close(); + } catch (IOException unused) { + } + } } } |