Handle exceptions in delete command

This commit is contained in:
Tobias Eidelpes 2021-01-06 13:22:11 +01:00
parent e30359652c
commit f975977853

View File

@ -358,17 +358,21 @@ public class MessageClient implements IMessageClient, Runnable {
@Command
@Override
public void delete(String id) throws BadPaddingException, IllegalBlockSizeException {
public void delete(String id) {
String message;
logger.info("Received 'delete' command for id " + id);
message = "delete " + id;
this.dmapOut.println(getAesCiphertext(message));
try {
this.dmapOut.println(getAesCiphertext(message));
String result = "";
result = getAesPlaintext(dmapIn.readLine());
System.out.println(result);
} catch (BadPaddingException | IllegalBlockSizeException e) {
logger.severe("Error during encryption/decryption");
e.printStackTrace();
} catch (IOException e) {
System.out.println("IO Exception " + e.getMessage());
logger.severe("Could not connect to MailboxHost " + this.mailboxHost + " on port " + this.mailboxPort);
shutdown();
}
}