mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-19 15:58:29 +00:00
Add better error logging for single backup Uris.
This commit is contained in:
parent
936e772ba0
commit
f796447815
@ -174,6 +174,7 @@ public class BackupUtil {
|
||||
|
||||
return new BackupInfo(backupTimestamp, documentFile.length(), documentFile.getUri());
|
||||
} else {
|
||||
logIssueWithDocumentFile(documentFile);
|
||||
Log.w(TAG, "Could not load backup info.");
|
||||
return null;
|
||||
}
|
||||
@ -259,6 +260,20 @@ public class BackupUtil {
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static void logIssueWithDocumentFile(@Nullable DocumentFile documentFile) {
|
||||
if (documentFile == null) {
|
||||
throw new AssertionError("We do not support platforms prior to KitKat.");
|
||||
} else if (!documentFile.exists()) {
|
||||
Log.w(TAG, "The document at the specified Uri cannot be found.");
|
||||
} else if (!documentFile.canRead()) {
|
||||
Log.w(TAG, "The document at the specified Uri cannot be read.");
|
||||
} else if (!documentFile.canWrite()) {
|
||||
Log.w(TAG, "The document at the specified Uri cannot be written to.");
|
||||
} else if (!documentFile.getName().endsWith(".backup")) {
|
||||
Log.w(TAG, "The document at the specified Uri has an unsupported file extension.");
|
||||
}
|
||||
}
|
||||
|
||||
public static class BackupInfo {
|
||||
|
||||
private final long timestamp;
|
||||
|
Loading…
x
Reference in New Issue
Block a user