catch (MTPException mtpe) {
if (myLogger.isLoggable(Logger.WARNING) && !isPersistentDeliveryRetry(msg))
myLogger.log(Logger.WARNING, "Cannot deliver message to address: " + address + " [" + mtpe.toString() + "]. Trying the next one...");
}
}
notifyFailureToSender(msg, receiverID, new InternalError(ACLMessage.AMS_FAILURE_FOREIGN_AGENT_UNREACHABLE + ": " + "No valid address contained within the AID " + receiverID.getName()));
}
else {
notifyFailureToSender(msg, receiverID, new InternalError(ACLMessage.AMS_FAILURE_FOREIGN_AGENT_NO_ADDRESS));
}
}
}
catch (NotFoundException nfe) {
// The receiver does not exist --> Send a FAILURE message
if (msg.getTraceID() != null) {
myLogger.log(Logger.WARNING, msg.getTraceID()+" - Receiver does not exist.", nfe);
}
notifyFailureToSender(msg, receiverID, new InternalError(ACLMessage.AMS_FAILURE_AGENT_NOT_FOUND + ": " + nfe.getMessage()));
}
catch (IMTPException imtpe) {
// Can't reach the destination container --> Send a FAILURE message
String id = (msg.getTraceID() != null ? msg.getTraceID() : MessageManager.stringify(msg));
myLogger.log(Logger.WARNING, id+" - Receiver unreachable.", imtpe);
notifyFailureToSender(msg, receiverID, new InternalError(ACLMessage.AMS_FAILURE_AGENT_UNREACHABLE + ": " + imtpe.getMessage()));
}
catch (ServiceException se) {
// Service error during delivery --> Send a FAILURE message
String id = (msg.getTraceID() != null ? msg.getTraceID() : MessageManager.stringify(msg));
myLogger.log(Logger.WARNING, id+" - Service error delivering message.", se);
notifyFailureToSender(msg, receiverID, new InternalError(ACLMessage.AMS_FAILURE_SERVICE_ERROR + ": " + se.getMessage()));
}
catch (JADESecurityException jse) {
// Delivery not authorized--> Send a FAILURE message
if (msg.getTraceID() != null) {
myLogger.log(Logger.WARNING, msg.getTraceID()+" - Not authorized.", jse);
}
notifyFailureToSender(msg, receiverID, new InternalError(ACLMessage.AMS_FAILURE_UNAUTHORIZED + ": " + jse.getMessage()));
}
}