log.warning("Unexpected msgInfo with length==0, requestId=" + requestId + " data=" + emailData.toXml(true));
Thread.dumpStack();
return;
}
for (int j=0; j<msgInfos.length; j++) {
MsgInfo msgInfo = msgInfos[j];
msgInfo.setRequestIdGuessed(emailData.isRequestIdFromSentDate());
msgInfo.setBounceObject(BOUNCE_MAILFROM_KEY, emailData.getFrom());
// The messageId could be in the subject and not in the attachment
msgInfo.setBounceObject(BOUNCE_MESSAGEID_KEY, emailData.getMessageId(messageIdFileName));
AttachmentHolder[] attachments = emailData.getAttachments();
for (int i=0; i<attachments.length; i++) {
AttachmentHolder a = attachments[i];
if (a == msgUnitAttachmentHolder)
continue;
// TODO: Determine which attachments to bounce
msgInfo.setBounceObject(a.getFileName(), a);
}
}
} catch (Throwable e) {
log.warning("Error parsing email data from "
+ pop3Url
+ ", check if client and server have identical compression settings: "
+ e.toString() + ": " + emailData.toXml(true));
return;
}
// Response and Exception messages should NEVER expire
if (emailData.isExpired(messageIdFileName) && msgInfos[0].isInvoke()) {
log.warning("Message is expired, we discard it: " + emailData.toString());
return;
}
// For XmlScript && INVOKE we could have multiple message bundled
// else length is always 1!
for (int i=0; i<msgInfos.length; i++) {
MsgInfo msgInfo = msgInfos[i];
// If counterside has stripped information we add it again from the messageId attachment
if (msgInfo.getRequestId().length() == 0)
msgInfo.setRequestId(emailData.getRequestId(messageIdFileName));
if (msgInfo.getSecretSessionId().length() == 0)
msgInfo.setSecretSessionId(emailData.getSessionId(messageIdFileName));
try {
if (i==0 && msgInfo.isInvoke()) {
if (isLoopingMail(msgInfo, emailData))
return;
}
/*
Memory leak cleanup is handled by EmailDriver.java on LogoutEvent
if (MethodName.DISCONNECT.equals(msgInfo.getMethodName())) {
removeFromLoopProtection(emailData.getFrom());
}
*/
// This wakes up the blocking thread of sendEmail() and returns the
// returnQos or the received invocation
// On server side it typically invokes the core connect() or publish() etc.
if (receiveReply(msgInfo, false) == false) {
log.warning("Error parsing email data from "
+ getPop3Driver().getPop3Url()
+ ", CONNECT etc is not yet implemented");
}
if (i==0 && msgInfos.length > 1 && MethodName.CONNECT.equals(msgInfo.getMethodName())) {
// If multiple requests where bundled pass the others the secret session id
for (int k=1; k<msgInfos.length; k++)
msgInfos[k].setSecretSessionId(msgInfo.getSecretSessionId());
}
} catch (Throwable e) {
if (log.isLoggable(Level.FINE))
e.printStackTrace();
log.warning("Can't process email data from "