public MailImpl retrieve(String key) {
if ((DEEP_DEBUG) && (getLogger().isDebugEnabled())) {
getLogger().debug("Retrieving mail: " + key);
}
try {
MailImpl mc = null;
try {
mc = (MailImpl) or.get(key);
} catch (RuntimeException re) {
StringBuffer exceptionBuffer =
new StringBuffer(128)
.append("Exception retrieving mail: ")
.append(re.toString())
.append(", so we're deleting it... good riddance!");
getLogger().error(exceptionBuffer.toString());
remove(key);
return null;
}
MimeMessageAvalonSource source = new MimeMessageAvalonSource(sr, destination, key);
mc.setMessage(new MimeMessageWrapper(source));
return mc;
} catch (Exception me) {
getLogger().error("Exception retrieving mail: " + me);
throw new RuntimeException("Exception while retrieving mail: " + me.getMessage());