Code cleanup

This commit is contained in:
2016-02-25 16:36:43 +01:00
parent 0a00a0a1b4
commit f6add5b2ea
12 changed files with 80 additions and 57 deletions

View File

@ -416,7 +416,8 @@ public class BitmessageContext {
customCommandHandler = new CustomCommandHandler() {
@Override
public MessagePayload handle(CustomMessage request) {
throw new RuntimeException("Received custom request, but no custom command handler configured.");
throw new IllegalStateException(
"Received custom request, but no custom command handler configured.");
}
};
}

View File

@ -17,6 +17,7 @@
package ch.dissem.bitmessage.entity.payload;
import ch.dissem.bitmessage.entity.Streamable;
import ch.dissem.bitmessage.exception.ApplicationException;
import ch.dissem.bitmessage.exception.DecryptionFailedException;
import ch.dissem.bitmessage.utils.*;
import org.slf4j.Logger;
@ -123,7 +124,7 @@ public class CryptoBox implements Streamable {
writeWithoutMAC(macData);
return security().mac(key_m, macData.toByteArray());
} catch (IOException e) {
throw new RuntimeException(e);
throw new ApplicationException(e);
}
}

View File

@ -18,6 +18,7 @@
package ch.dissem.bitmessage.utils;
import ch.dissem.bitmessage.exception.AddressFormatException;
import ch.dissem.bitmessage.exception.ApplicationException;
import java.io.UnsupportedEncodingException;
@ -83,7 +84,7 @@ public class Base58 {
try {
return new String(output, "US-ASCII");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e); // Cannot happen.
throw new ApplicationException(e); // Cannot happen.
}
}