From dea847c2ace8894a595cf9bd87764ce2ca9698ab Mon Sep 17 00:00:00 2001 From: Patrick Tjin Date: Wed, 1 Oct 2014 10:13:44 -0700 Subject: [PATCH] Skip over directories when iterating tombstones Bug: 17380601 Change-Id: Idb6e559a89c7438751bd7a52375b9789454e0334 --- core/java/com/android/server/BootReceiver.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/java/com/android/server/BootReceiver.java b/core/java/com/android/server/BootReceiver.java index 468d7f1f15a9..d39bf076bf5f 100644 --- a/core/java/com/android/server/BootReceiver.java +++ b/core/java/com/android/server/BootReceiver.java @@ -155,8 +155,10 @@ public class BootReceiver extends BroadcastReceiver { // Scan existing tombstones (in case any new ones appeared) File[] tombstoneFiles = TOMBSTONE_DIR.listFiles(); for (int i = 0; tombstoneFiles != null && i < tombstoneFiles.length; i++) { - addFileToDropBox(db, prefs, headers, tombstoneFiles[i].getPath(), - LOG_SIZE, "SYSTEM_TOMBSTONE"); + if (tombstoneFiles[i].isFile()) { + addFileToDropBox(db, prefs, headers, tombstoneFiles[i].getPath(), + LOG_SIZE, "SYSTEM_TOMBSTONE"); + } } // Start watching for new tombstone files; will record them as they occur. @@ -165,8 +167,10 @@ public class BootReceiver extends BroadcastReceiver { @Override public void onEvent(int event, String path) { try { - String filename = new File(TOMBSTONE_DIR, path).getPath(); - addFileToDropBox(db, prefs, headers, filename, LOG_SIZE, "SYSTEM_TOMBSTONE"); + File file = new File(TOMBSTONE_DIR, path); + if (file.isFile()) { + addFileToDropBox(db, prefs, headers, file.getPath(), LOG_SIZE, "SYSTEM_TOMBSTONE"); + } } catch (IOException e) { Slog.e(TAG, "Can't log tombstone", e); } -- 2.11.0