Ignore exceptions when investigating failure reasons

Fix: 154428500
Test: boot
Test: code inspection
Change-Id: I2a69a58aaa43617f40bc52fd06cba730faa93672
diff --git a/core/java/android/database/sqlite/SQLiteConnection.java b/core/java/android/database/sqlite/SQLiteConnection.java
index f7c96a3..2f67f6d 100644
--- a/core/java/android/database/sqlite/SQLiteConnection.java
+++ b/core/java/android/database/sqlite/SQLiteConnection.java
@@ -228,19 +228,26 @@
         } catch (SQLiteCantOpenDatabaseException e) {
             String message = String.format("Cannot open database '%s'", file);
 
-            final Path path = FileSystems.getDefault().getPath(file);
-            final Path dir = path.getParent();
+            try {
+                // Try to diagnose for common reasons. If something fails in here, that's fine;
+                // just swallow the exception.
 
-            if (!Files.isDirectory(dir)) {
-                message += ": Directory " + dir + " doesn't exist";
-            } else if (!Files.exists(path)) {
-                message += ": File " + path + " doesn't exist";
-            } else if (!Files.isReadable(path)) {
-                message += ": File " + path + " is not readable";
-            } else if (Files.isDirectory(path)) {
-                message += ": Path " + path + " is a directory";
-            } else {
-                message += ": Unknown reason";
+                final Path path = FileSystems.getDefault().getPath(file);
+                final Path dir = path.getParent();
+
+                if (!Files.isDirectory(dir)) {
+                    message += ": Directory " + dir + " doesn't exist";
+                } else if (!Files.exists(path)) {
+                    message += ": File " + path + " doesn't exist";
+                } else if (!Files.isReadable(path)) {
+                    message += ": File " + path + " is not readable";
+                } else if (Files.isDirectory(path)) {
+                    message += ": Path " + path + " is a directory";
+                } else {
+                    message += ": Unknown reason";
+                }
+            } catch (Throwable th) {
+                message += ": Unknown reason; cannot examine filesystem: " + th.getMessage();
             }
             throw new SQLiteCantOpenDatabaseException(message, e);
         } finally {