return new URL(urlstr);
}
- public void setSalt() {
+ public void setSalt() throws ServerException{
try {
salt = new byte[SALT_SIZE];
random.nextBytes(salt);
}
} catch (Exception e) {
e.printStackTrace();
- throw new Error("Failed setting salt");
+ throw new ServerException("Failed setting salt");
}
initCrypt();
}
* numbers.
*/
- Slot[] putSlot(Slot slot, int max) {
+ Slot[] putSlot(Slot slot, int max) throws ServerException{
try {
if (salt == null) {
getSalt();
throw new Error("Bad response to putslot");
} catch (Exception e) {
e.printStackTrace();
- throw new Error("putSlot failed");
+ throw new ServerException("putSlot failed");
}
}
+
/**
* Request the server to send all slots with the given
* sequencenumber or newer.
*/
- Slot[] getSlots(long sequencenumber) {
+ Slot[] getSlots(long sequencenumber) throws ServerException {
try {
if (salt == null) {
getSalt();
return processSlots(dis);
} catch (Exception e) {
e.printStackTrace();
- throw new Error("getSlots failed");
+ throw new ServerException("getSlots failed");
}
}