catch outdated backup exception in ImportBackupActivity
This commit is contained in:
parent
dfd7410b1a
commit
e1b53cdaf6
|
@ -26,6 +26,19 @@ import com.google.common.io.CountingInputStream;
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
import com.google.gson.stream.JsonToken;
|
import com.google.gson.stream.JsonToken;
|
||||||
|
|
||||||
|
import eu.siacs.conversations.Config;
|
||||||
|
import eu.siacs.conversations.R;
|
||||||
|
import eu.siacs.conversations.crypto.axolotl.SQLiteAxolotlStore;
|
||||||
|
import eu.siacs.conversations.entities.Account;
|
||||||
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
|
import eu.siacs.conversations.entities.Message;
|
||||||
|
import eu.siacs.conversations.persistance.DatabaseBackend;
|
||||||
|
import eu.siacs.conversations.persistance.FileBackend;
|
||||||
|
import eu.siacs.conversations.ui.ManageAccountActivity;
|
||||||
|
import eu.siacs.conversations.utils.BackupFileHeader;
|
||||||
|
import eu.siacs.conversations.utils.SerialSingleThreadExecutor;
|
||||||
|
import eu.siacs.conversations.xmpp.Jid;
|
||||||
|
|
||||||
import org.bouncycastle.crypto.engines.AESEngine;
|
import org.bouncycastle.crypto.engines.AESEngine;
|
||||||
import org.bouncycastle.crypto.io.CipherInputStream;
|
import org.bouncycastle.crypto.io.CipherInputStream;
|
||||||
import org.bouncycastle.crypto.modes.AEADBlockCipher;
|
import org.bouncycastle.crypto.modes.AEADBlockCipher;
|
||||||
|
@ -56,19 +69,6 @@ import java.util.zip.ZipException;
|
||||||
|
|
||||||
import javax.crypto.BadPaddingException;
|
import javax.crypto.BadPaddingException;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
|
||||||
import eu.siacs.conversations.R;
|
|
||||||
import eu.siacs.conversations.crypto.axolotl.SQLiteAxolotlStore;
|
|
||||||
import eu.siacs.conversations.entities.Account;
|
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
|
||||||
import eu.siacs.conversations.entities.Message;
|
|
||||||
import eu.siacs.conversations.persistance.DatabaseBackend;
|
|
||||||
import eu.siacs.conversations.persistance.FileBackend;
|
|
||||||
import eu.siacs.conversations.ui.ManageAccountActivity;
|
|
||||||
import eu.siacs.conversations.utils.BackupFileHeader;
|
|
||||||
import eu.siacs.conversations.utils.SerialSingleThreadExecutor;
|
|
||||||
import eu.siacs.conversations.xmpp.Jid;
|
|
||||||
|
|
||||||
public class ImportBackupService extends Service {
|
public class ImportBackupService extends Service {
|
||||||
|
|
||||||
private static final int NOTIFICATION_ID = 21;
|
private static final int NOTIFICATION_ID = 21;
|
||||||
|
@ -92,7 +92,6 @@ public class ImportBackupService extends Service {
|
||||||
SQLiteAxolotlStore.IDENTITIES_TABLENAME);
|
SQLiteAxolotlStore.IDENTITIES_TABLENAME);
|
||||||
private static final Pattern COLUMN_PATTERN = Pattern.compile("^[a-zA-Z_]+$");
|
private static final Pattern COLUMN_PATTERN = Pattern.compile("^[a-zA-Z_]+$");
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
mDatabaseBackend = DatabaseBackend.getInstance(getBaseContext());
|
mDatabaseBackend = DatabaseBackend.getInstance(getBaseContext());
|
||||||
|
@ -167,6 +166,7 @@ public class ImportBackupService extends Service {
|
||||||
if (files == null) {
|
if (files == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Log.d(Config.LOGTAG, "looking for backups in " + directory);
|
||||||
for (final File file : files) {
|
for (final File file : files) {
|
||||||
if (file.isFile() && file.getName().endsWith(".ceb")) {
|
if (file.isFile() && file.getName().endsWith(".ceb")) {
|
||||||
try {
|
try {
|
||||||
|
@ -179,7 +179,9 @@ public class ImportBackupService extends Service {
|
||||||
} else {
|
} else {
|
||||||
backupFiles.add(backupFile);
|
backupFiles.add(backupFile);
|
||||||
}
|
}
|
||||||
} catch (IOException | IllegalArgumentException e) {
|
} catch (final IOException
|
||||||
|
| IllegalArgumentException
|
||||||
|
| BackupFileHeader.OutdatedBackupFileVersion e) {
|
||||||
Log.d(Config.LOGTAG, "unable to read backup file ", e);
|
Log.d(Config.LOGTAG, "unable to read backup file ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue