Fix bug where Consumer() would close on failed sendErrorMail()
This commit is contained in:
parent
8091a763ad
commit
6c22e6bec5
@ -48,13 +48,21 @@ public class DMAPConnection implements Runnable {
|
|||||||
listMessages();
|
listMessages();
|
||||||
} else if ("delete".equals(userInput.split("\\s+")[0])) {
|
} else if ("delete".equals(userInput.split("\\s+")[0])) {
|
||||||
if (userInput.split("\\s+").length == 2) {
|
if (userInput.split("\\s+").length == 2) {
|
||||||
|
try {
|
||||||
deleteMessage(userInput.split("\\s+")[1]);
|
deleteMessage(userInput.split("\\s+")[1]);
|
||||||
|
} catch (MessageNotFoundException e) {
|
||||||
|
out.println(e.getMessage());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
out.println("Please supply a message id to delete!");
|
out.println("Please supply a message id to delete!");
|
||||||
}
|
}
|
||||||
} else if ("show".equals(userInput.split("\\s+")[0])) {
|
} else if ("show".equals(userInput.split("\\s+")[0])) {
|
||||||
if (userInput.split("\\s+").length == 2) {
|
if (userInput.split("\\s+").length == 2) {
|
||||||
|
try {
|
||||||
showMessage(userInput.split("\\s+")[1]);
|
showMessage(userInput.split("\\s+")[1]);
|
||||||
|
} catch (MessageNotFoundException e) {
|
||||||
|
out.println(e.getMessage());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
out.println("Please supply a message id to show!");
|
out.println("Please supply a message id to show!");
|
||||||
}
|
}
|
||||||
@ -70,8 +78,6 @@ public class DMAPConnection implements Runnable {
|
|||||||
logger.severe("Failed to get IO-Stream");
|
logger.severe("Failed to get IO-Stream");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
shutdown();
|
shutdown();
|
||||||
} catch (MessageNotFoundException e) {
|
|
||||||
out.println(e.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,6 +170,7 @@ public class DMAPConnection implements Runnable {
|
|||||||
for (Message m : storage.get(currentUser)) {
|
for (Message m : storage.get(currentUser)) {
|
||||||
if (m.getId() == i) {
|
if (m.getId() == i) {
|
||||||
storage.get(currentUser).remove(m);
|
storage.get(currentUser).remove(m);
|
||||||
|
out.println("ok");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import java.io.*;
|
|||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -64,6 +65,7 @@ public class DMTPConnection implements Runnable {
|
|||||||
} else if ("to".equals(userInput.split("\\s+")[0])) {
|
} else if ("to".equals(userInput.split("\\s+")[0])) {
|
||||||
msg.setTo(new ArrayList<>());
|
msg.setTo(new ArrayList<>());
|
||||||
String[] emailAddresses = userInput.split("\\s+")[1].split(",");
|
String[] emailAddresses = userInput.split("\\s+")[1].split(",");
|
||||||
|
logger.info("Split EMail addresses: " + Arrays.toString(emailAddresses));
|
||||||
int count = 0;
|
int count = 0;
|
||||||
try {
|
try {
|
||||||
for (String emailAddress : emailAddresses) {
|
for (String emailAddress : emailAddresses) {
|
||||||
|
|||||||
@ -162,12 +162,10 @@ public class TransferServer implements ITransferServer, Runnable {
|
|||||||
try {
|
try {
|
||||||
port = domainLookup(recipient);
|
port = domainLookup(recipient);
|
||||||
logger.info("Domain lookup successful. Port is: " + port);
|
logger.info("Domain lookup successful. Port is: " + port);
|
||||||
|
replayMessage(msg, port);
|
||||||
} catch (UnknownDomain e) {
|
} catch (UnknownDomain e) {
|
||||||
sendErrorMail(msg, e.getMessage());
|
sendErrorMail(msg, e.getMessage());
|
||||||
shutdown();
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
replayMessage(msg, port);
|
|
||||||
}
|
}
|
||||||
lock.notify();
|
lock.notify();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user