result = factory.createSMTPAddress(
failure.getAddress().getAddress());
} catch (MalformedAddressException e) {
LOGGER.warn("unable-to-convert-mps-address",
failure.getAddress().getAddress());
throw new RecipientException(
EXCEPTION_LOCALIZER.format(
"unable-to-convert-mps-address",
failure.getAddress().getAddress()));
}
} else if (failure.getMSISDN() != null) {
try {
result = factory.createMSISDN(
failure.getMSISDN());
} catch (MalformedAddressException e) {
LOGGER.warn("unable-to-convert-mps-address",
failure.getMSISDN());
throw new RecipientException(
EXCEPTION_LOCALIZER.format(
"unable-to-convert-mps-address",
failure.getMSISDN()));
}
} else {
// We should have detected this before now, so this is really
// unexpected and indicates a bug in how the initial recipient
// list is processed.
throw new RecipientException(
EXCEPTION_LOCALIZER.format(
"unable-to-convert-mps-address",
failure));
}
return result;