aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain
diff options
context:
space:
mode:
authorTim Bray <timbray@gmail.com>2014-05-04 17:16:58 -0700
committerTim Bray <timbray@gmail.com>2014-05-04 17:16:58 -0700
commit90b4db07925ec4741fedfa75eed4ed6acc533696 (patch)
treeccd4b9055b914a017befbe745d6dde7097df6c0f /OpenKeychain
parent5b0f19fcebd586235be7c895769ccb111c97e78e (diff)
downloadopen-keychain-90b4db07925ec4741fedfa75eed4ed6acc533696.tar.gz
open-keychain-90b4db07925ec4741fedfa75eed4ed6acc533696.tar.bz2
open-keychain-90b4db07925ec4741fedfa75eed4ed6acc533696.zip
Per pull-request comments.
Diffstat (limited to 'OpenKeychain')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysKeybaseFragment.java22
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListKeybaseLoader.java3
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListServerLoader.java3
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java16
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/JWalk.java17
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java18
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeybaseKeyServer.java18
7 files changed, 52 insertions, 45 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysKeybaseFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysKeybaseFragment.java
index 7ae57cec3..a996079c9 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysKeybaseFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysKeybaseFragment.java
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package org.sufficientlysecure.keychain.ui;
import android.content.Context;
@@ -29,7 +46,6 @@ public class ImportKeysKeybaseFragment extends Fragment {
private EditText mQueryEditText;
public static final String ARG_QUERY = "query";
- public static final String ARG_DISABLE_QUERY_EDIT = "disable_query_edit";
/**
* Creates new instance of this fragment
@@ -95,10 +111,6 @@ public class ImportKeysKeybaseFragment extends Fragment {
String query = getArguments().getString(ARG_QUERY);
mQueryEditText.setText(query, TextView.BufferType.EDITABLE);
}
-
- if (getArguments().getBoolean(ARG_DISABLE_QUERY_EDIT, false)) {
- mQueryEditText.setEnabled(false);
- }
}
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListKeybaseLoader.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListKeybaseLoader.java
index 73ff9a8f8..e66032482 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListKeybaseLoader.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListKeybaseLoader.java
@@ -94,13 +94,10 @@ public class ImportKeysListKeybaseLoader
mEntryList.addAll(searchResult);
mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, null);
} catch (KeyServer.InsufficientQuery e) {
- Log.e(Constants.TAG, "InsufficientQuery", e);
mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e);
} catch (KeyServer.QueryException e) {
- Log.e(Constants.TAG, "QueryException", e);
mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e);
} catch (KeyServer.TooManyResponses e) {
- Log.e(Constants.TAG, "TooManyResponses", e);
mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e);
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListServerLoader.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListServerLoader.java
index 838aeefee..65810064c 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListServerLoader.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListServerLoader.java
@@ -116,13 +116,10 @@ public class ImportKeysListServerLoader
}
mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, null);
} catch (KeyServer.InsufficientQuery e) {
- Log.e(Constants.TAG, "InsufficientQuery", e);
mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e);
} catch (KeyServer.QueryException e) {
- Log.e(Constants.TAG, "QueryException", e);
mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e);
} catch (KeyServer.TooManyResponses e) {
- Log.e(Constants.TAG, "TooManyResponses", e);
mEntryListWrapper = new AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>(mEntryList, e);
}
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java
index cf658b0b6..b81fba05d 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java
@@ -34,7 +34,6 @@ import org.sufficientlysecure.keychain.pgp.PgpHelper;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
@@ -167,21 +166,6 @@ public class HkpKeyServer extends KeyServer {
mPort = port;
}
- private static String readAll(InputStream in, String encoding) throws IOException {
- ByteArrayOutputStream raw = new ByteArrayOutputStream();
-
- byte buffer[] = new byte[1 << 16];
- int n = 0;
- while ((n = in.read(buffer)) != -1) {
- raw.write(buffer, 0, n);
- }
-
- if (encoding == null) {
- encoding = "utf8";
- }
- return raw.toString(encoding);
- }
-
private String query(String request) throws QueryException, HttpError {
InetAddress ips[];
try {
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/JWalk.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/JWalk.java
index 6f9c4cfa5..7ae1d8fab 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/JWalk.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/JWalk.java
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2014 Tim Bray <tbray@textuality.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package org.sufficientlysecure.keychain.util;
import org.json.JSONArray;
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java
index 2b97165ac..94c02a773 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java
@@ -20,6 +20,9 @@ package org.sufficientlysecure.keychain.util;
import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.List;
public abstract class KeyServer {
@@ -49,4 +52,19 @@ public abstract class KeyServer {
abstract String get(String keyIdHex) throws QueryException;
abstract void add(String armoredKey) throws AddKeyException;
+
+ public static String readAll(InputStream in, String encoding) throws IOException {
+ ByteArrayOutputStream raw = new ByteArrayOutputStream();
+
+ byte buffer[] = new byte[1 << 16];
+ int n = 0;
+ while ((n = in.read(buffer)) != -1) {
+ raw.write(buffer, 0, n);
+ }
+
+ if (encoding == null) {
+ encoding = "utf8";
+ }
+ return raw.toString(encoding);
+ }
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeybaseKeyServer.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeybaseKeyServer.java
index dee3899a8..fb58e9f1d 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeybaseKeyServer.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeybaseKeyServer.java
@@ -24,9 +24,6 @@ import org.json.JSONObject;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
@@ -39,21 +36,6 @@ public class KeybaseKeyServer extends KeyServer {
private WeakHashMap<String, String> mKeyCache = new WeakHashMap<String, String>();
- private static String readAll(InputStream in, String encoding) throws IOException {
- ByteArrayOutputStream raw = new ByteArrayOutputStream();
-
- byte buffer[] = new byte[1 << 16];
- int n = 0;
- while ((n = in.read(buffer)) != -1) {
- raw.write(buffer, 0, n);
- }
-
- if (encoding == null) {
- encoding = "utf8";
- }
- return raw.toString(encoding);
- }
-
@Override
public ArrayList<ImportKeysListEntry> search(String query) throws QueryException, TooManyResponses,
InsufficientQuery {