gave HKP server proper error handling, going through all IPs of a pool until a response is received, reporting "too many responses", "no keys found", "insufficient query" correctly

Update issue 9
Proper error handling added.
This commit is contained in:
Thialfihar
2010-08-17 14:51:39 +00:00
parent 96162b6608
commit e4dd80005c
4 changed files with 130 additions and 39 deletions

View File

@@ -1,13 +1,23 @@
package org.thialfihar.android.apg;
import java.io.IOException;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.util.Date;
import java.util.List;
import java.util.Vector;
public abstract class KeyServer {
static public class QueryException extends Exception {
private static final long serialVersionUID = 2703768928624654512L;
public QueryException(String message) {
super(message);
}
}
static public class TooManyResponses extends Exception {
private static final long serialVersionUID = 2703768928624654513L;
}
static public class InsufficientQuery extends Exception {
private static final long serialVersionUID = 2703768928624654514L;
}
static public class KeyInfo implements Serializable {
private static final long serialVersionUID = -7797972113284992662L;
Vector<String> userIds;
@@ -18,6 +28,6 @@ public abstract class KeyServer {
int size;
String algorithm;
}
abstract List<KeyInfo> search(String query) throws MalformedURLException, IOException;
abstract String get(long keyId) throws MalformedURLException, IOException;
abstract List<KeyInfo> search(String query) throws QueryException, TooManyResponses, InsufficientQuery;
abstract String get(long keyId) throws QueryException;
}