Change UnknownDomain exception name
This commit is contained in:
parent
2d9b157b78
commit
d6c78911aa
@ -1,7 +0,0 @@
|
|||||||
package dslab.exception;
|
|
||||||
|
|
||||||
public class UnknownDomain extends Exception {
|
|
||||||
public UnknownDomain(String errorMessage) {
|
|
||||||
super(errorMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package dslab.exception;
|
||||||
|
|
||||||
|
public class UnknownDomainException extends Exception {
|
||||||
|
public UnknownDomainException(String errorMessage) {
|
||||||
|
super(errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -15,7 +15,7 @@ import dslab.ComponentFactory;
|
|||||||
import dslab.Email;
|
import dslab.Email;
|
||||||
import dslab.Message;
|
import dslab.Message;
|
||||||
import dslab.exception.MalformedInputException;
|
import dslab.exception.MalformedInputException;
|
||||||
import dslab.exception.UnknownDomain;
|
import dslab.exception.UnknownDomainException;
|
||||||
import dslab.util.Config;
|
import dslab.util.Config;
|
||||||
|
|
||||||
public class TransferServer implements ITransferServer, Runnable {
|
public class TransferServer implements ITransferServer, Runnable {
|
||||||
@ -171,7 +171,7 @@ public class TransferServer implements ITransferServer, Runnable {
|
|||||||
replayMessage(msg, port);
|
replayMessage(msg, port);
|
||||||
sent.put(recipient.getDomain(), true);
|
sent.put(recipient.getDomain(), true);
|
||||||
}
|
}
|
||||||
} catch (UnknownDomain e) {
|
} catch (UnknownDomainException e) {
|
||||||
sendErrorMail(msg, e.getMessage());
|
sendErrorMail(msg, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,11 +210,11 @@ public class TransferServer implements ITransferServer, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int domainLookup(Email email) throws UnknownDomain {
|
private int domainLookup(Email email) throws UnknownDomainException {
|
||||||
logger.info("Performing domain lookup for address " + email.toString());
|
logger.info("Performing domain lookup for address " + email.toString());
|
||||||
if (this.mailboxServers.containsKey(email.getDomain()))
|
if (this.mailboxServers.containsKey(email.getDomain()))
|
||||||
return this.mailboxServers.get(email.getDomain());
|
return this.mailboxServers.get(email.getDomain());
|
||||||
throw new UnknownDomain("error domain not found: " + email.getDomain());
|
throw new UnknownDomainException("error domain not found: " + email.getDomain());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendErrorMail(Message msg, String error) {
|
private void sendErrorMail(Message msg, String error) {
|
||||||
@ -223,7 +223,7 @@ public class TransferServer implements ITransferServer, Runnable {
|
|||||||
int port;
|
int port;
|
||||||
try {
|
try {
|
||||||
port = domainLookup(errorMessage.getFrom());
|
port = domainLookup(errorMessage.getFrom());
|
||||||
} catch (UnknownDomain e) {
|
} catch (UnknownDomainException e) {
|
||||||
logger.severe("Sending error mail failed because sender domain is unknown");
|
logger.severe("Sending error mail failed because sender domain is unknown");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user