aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-05-25 13:55:29 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2014-05-25 13:55:29 +0200
commit13d4a6d902d61a0a85db3bdc07996b317f5ecaad (patch)
tree9b2baff477a5b9b58e366a05633f6c4e8642b174 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java
parent8a2ffd8f90e9653ed69f945a94f6b9702dbdfff4 (diff)
parent58da3d12b0a59a32054478c53e6c5a219b71f61f (diff)
downloadopen-keychain-13d4a6d902d61a0a85db3bdc07996b317f5ecaad.tar.gz
open-keychain-13d4a6d902d61a0a85db3bdc07996b317f5ecaad.tar.bz2
open-keychain-13d4a6d902d61a0a85db3bdc07996b317f5ecaad.zip
Merge pull request #632 from timbray/master
Refactor server query exceptions again
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java30
1 files changed, 11 insertions, 19 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java
index e93d717e1..d9bd9b782 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java
@@ -211,7 +211,7 @@ public class ImportKeysListFragment extends ListFragment implements
@Override
public Loader<AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>>
- onCreateLoader(int id, Bundle args) {
+ onCreateLoader(int id, Bundle args) {
switch (id) {
case LOADER_ID_BYTES: {
InputData inputData = getInputData(mKeyBytes, mDataUri);
@@ -273,38 +273,30 @@ public class ImportKeysListFragment extends ListFragment implements
break;
case LOADER_ID_SERVER_QUERY:
+ case LOADER_ID_KEYBASE:
+ // TODO: possibly fine-tune message building for these two cases
if (error == null) {
AppMsg.makeText(
getActivity(), getResources().getQuantityString(R.plurals.keys_found,
mAdapter.getCount(), mAdapter.getCount()),
AppMsg.STYLE_INFO
).show();
- } else if (error instanceof Keyserver.InsufficientQuery) {
+ } else if (error instanceof Keyserver.QueryTooShortException) {
AppMsg.makeText(getActivity(), R.string.error_keyserver_insufficient_query,
AppMsg.STYLE_ALERT).show();
- } else if (error instanceof Keyserver.QueryException) {
- AppMsg.makeText(getActivity(), R.string.error_keyserver_query,
- AppMsg.STYLE_ALERT).show();
- } else if (error instanceof Keyserver.TooManyResponses) {
+ } else if (error instanceof Keyserver.TooManyResponsesException) {
AppMsg.makeText(getActivity(), R.string.error_keyserver_too_many_responses,
AppMsg.STYLE_ALERT).show();
+ } else if (error instanceof Keyserver.QueryFailedException) {
+ Log.d(Constants.TAG,
+ "Unrecoverable keyserver query error: " + error.getLocalizedMessage());
+ String alert = getActivity().getString(R.string.error_searching_keys);
+ alert = alert + " (" + error.getLocalizedMessage() + ")";
+ AppMsg.makeText(getActivity(), alert, AppMsg.STYLE_ALERT).show();
}
break;
- case LOADER_ID_KEYBASE:
-
- if (error == null) {
- AppMsg.makeText(
- getActivity(), getResources().getQuantityString(R.plurals.keys_found,
- mAdapter.getCount(), mAdapter.getCount()),
- AppMsg.STYLE_INFO
- ).show();
- } else if (error instanceof Keyserver.QueryException) {
- AppMsg.makeText(getActivity(), R.string.error_keyserver_query,
- AppMsg.STYLE_ALERT).show();
- }
-
default:
break;
}