Skip over directories when iterating tombstones

Bug: 17380601
Change-Id: Idb6e559a89c7438751bd7a52375b9789454e0334
This commit is contained in:
Patrick Tjin
2014-10-01 10:13:44 -07:00
committed by Pat Tjin
parent c403a340cb
commit dea847c2ac

View File

@@ -155,9 +155,11 @@ public class BootReceiver extends BroadcastReceiver {
// Scan existing tombstones (in case any new ones appeared) // Scan existing tombstones (in case any new ones appeared)
File[] tombstoneFiles = TOMBSTONE_DIR.listFiles(); File[] tombstoneFiles = TOMBSTONE_DIR.listFiles();
for (int i = 0; tombstoneFiles != null && i < tombstoneFiles.length; i++) { for (int i = 0; tombstoneFiles != null && i < tombstoneFiles.length; i++) {
if (tombstoneFiles[i].isFile()) {
addFileToDropBox(db, prefs, headers, tombstoneFiles[i].getPath(), addFileToDropBox(db, prefs, headers, tombstoneFiles[i].getPath(),
LOG_SIZE, "SYSTEM_TOMBSTONE"); LOG_SIZE, "SYSTEM_TOMBSTONE");
} }
}
// Start watching for new tombstone files; will record them as they occur. // Start watching for new tombstone files; will record them as they occur.
// This gets registered with the singleton file observer thread. // This gets registered with the singleton file observer thread.
@@ -165,8 +167,10 @@ public class BootReceiver extends BroadcastReceiver {
@Override @Override
public void onEvent(int event, String path) { public void onEvent(int event, String path) {
try { try {
String filename = new File(TOMBSTONE_DIR, path).getPath(); File file = new File(TOMBSTONE_DIR, path);
addFileToDropBox(db, prefs, headers, filename, LOG_SIZE, "SYSTEM_TOMBSTONE"); if (file.isFile()) {
addFileToDropBox(db, prefs, headers, file.getPath(), LOG_SIZE, "SYSTEM_TOMBSTONE");
}
} catch (IOException e) { } catch (IOException e) {
Slog.e(TAG, "Can't log tombstone", e); Slog.e(TAG, "Can't log tombstone", e);
} }