aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-09-13 17:31:20 +0200
committerChristian Schneppe <christian@pix-art.de>2018-09-13 17:31:20 +0200
commitbbd3ef58fc14edcd1ba7210b45bc764560f367e7 (patch)
tree52b7fafd36bf8b5aeff84831a56bce87dfb6e4db /src/main
parent3a9859546aa8f9881d1c26ebebbeb2db2923b007 (diff)
more bug fixes in ExportLogsService
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/services/ExportLogsService.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/services/ExportLogsService.java b/src/main/java/de/pixart/messenger/services/ExportLogsService.java
index c2704490d..b0da108ba 100644
--- a/src/main/java/de/pixart/messenger/services/ExportLogsService.java
+++ b/src/main/java/de/pixart/messenger/services/ExportLogsService.java
@@ -81,17 +81,19 @@ public class ExportLogsService extends XmppConnectionService {
getNotificationService().exportLogsServiceNotification(getNotificationService().exportLogsNotification());
List<Conversation> conversations = mDatabaseBackend.getConversations(Conversation.STATUS_AVAILABLE);
conversations.addAll(mDatabaseBackend.getConversations(Conversation.STATUS_ARCHIVED));
- if (ReadableLogsEnabled) {
- for (Conversation conversation : conversations) {
- writeToFile(conversation);
+ if (mAccounts.size() >= 1) {
+ if (ReadableLogsEnabled) {
+ for (Conversation conversation : conversations) {
+ writeToFile(conversation);
+ }
}
- }
- if (mAccounts.size() == 1) {
try {
ExportDatabase();
} catch (IOException e) {
e.printStackTrace();
}
+ } else {
+ Log.d(Config.LOGTAG, "ExportLogsService: no accounts, aborting export");
}
}
@@ -172,7 +174,8 @@ public class ExportLogsService extends XmppConnectionService {
File directory = new File(FileBackend.getConversationsDirectory("Database", false));
// Create the folder if it doesn't exist:
if (!directory.exists()) {
- directory.mkdirs();
+ boolean directory_created = directory.mkdirs();
+ Log.d(Config.LOGTAG, "ExportLogsService: backup directory created " + directory_created);
}
//Delete old database export file
File temp_db_file = new File(directory + "/database.bak");
@@ -198,6 +201,7 @@ public class ExportLogsService extends XmppConnectionService {
// encrypt database from the input file to the output file
try {
EncryptDecryptFile.encrypt(InputFile, OutputFile, EncryptionKey);
+ Log.d(Config.LOGTAG, "ExportLogsService: starting encrypted output to " + OutputFile.toString());
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
Log.d(Config.LOGTAG, "ExportLogsService: Database exporter: encryption failed with " + e);
e.printStackTrace();
@@ -207,6 +211,8 @@ public class ExportLogsService extends XmppConnectionService {
} catch (IOException e) {
Log.d(Config.LOGTAG, "ExportLogsService: Database exporter: encryption failed (IO) with " + e);
e.printStackTrace();
+ } finally {
+ Log.d(Config.LOGTAG, "ExportLogsService: backup job finished");
}
}