mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-29 18:18:11 +00:00
Don't catch the IllegalArgumentException when calling getMissingIndices
We always call isSingleBatch beforehand, so if the exception occurs, it's a bug.
This commit is contained in:
parent
70ceca6a7b
commit
029ca81bbf
1 changed files with 14 additions and 18 deletions
|
@ -367,31 +367,27 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
||||||
VaultEntry entry = new VaultEntry(info);
|
VaultEntry entry = new VaultEntry(info);
|
||||||
entries.add(entry);
|
entries.add(entry);
|
||||||
}
|
}
|
||||||
} catch (GoogleAuthInfoException | IllegalArgumentException e) {
|
} catch (GoogleAuthInfoException e) {
|
||||||
errors.add(buildImportError(res.getFileName(), e));
|
errors.add(buildImportError(res.getFileName(), e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final DialogInterface.OnClickListener dialogDismissHandler = (dialog, which) -> importScannedEntries(entries);
|
final DialogInterface.OnClickListener dialogDismissHandler = (dialog, which) -> importScannedEntries(entries);
|
||||||
if (!googleAuthExports.isEmpty()) {
|
if (!googleAuthExports.isEmpty()) {
|
||||||
try {
|
boolean isSingleBatch = GoogleAuthInfo.Export.isSingleBatch(googleAuthExports);
|
||||||
if (!GoogleAuthInfo.Export.isSingleBatch(googleAuthExports) && errors.size() > 0) {
|
if (!isSingleBatch && errors.size() > 0) {
|
||||||
errors.add(getString(R.string.unrelated_google_auth_batches_error));
|
errors.add(getString(R.string.unrelated_google_auth_batches_error));
|
||||||
Dialogs.showMultiMessageDialog(this, R.string.import_error_title, getString(R.string.no_tokens_can_be_imported), errors, null);
|
Dialogs.showMultiMessageDialog(this, R.string.import_error_title, getString(R.string.no_tokens_can_be_imported), errors, null);
|
||||||
return;
|
|
||||||
} else if (!GoogleAuthInfo.Export.isSingleBatch(googleAuthExports)) {
|
|
||||||
Dialogs.showErrorDialog(this, R.string.import_google_auth_failure, getString(R.string.unrelated_google_auth_batches_error));
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
List<Integer> missingIndices = GoogleAuthInfo.Export.getMissingIndices(googleAuthExports);
|
|
||||||
if (missingIndices.size() != 0) {
|
|
||||||
Dialogs.showPartialGoogleAuthImportWarningDialog(this, missingIndices, entries.size(), errors, dialogDismissHandler);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
Dialogs.showErrorDialog(this, getString(R.string.import_google_auth_failure), e);
|
|
||||||
return;
|
return;
|
||||||
|
} else if (!isSingleBatch) {
|
||||||
|
Dialogs.showErrorDialog(this, R.string.import_google_auth_failure, getString(R.string.unrelated_google_auth_batches_error));
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
List<Integer> missingIndices = GoogleAuthInfo.Export.getMissingIndices(googleAuthExports);
|
||||||
|
if (missingIndices.size() != 0) {
|
||||||
|
Dialogs.showPartialGoogleAuthImportWarningDialog(this, missingIndices, entries.size(), errors, dialogDismissHandler);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue