MessageSourceAccessor.class);
}
}
public void reportError(ErrorInfo info) {
Message mail = new Message();
String mailTo = getMessageByKeySuffix(".mailTo");
if (!StringUtils.isEmpty(mailTo)) {
boolean doOutlookWorkaround = false;
if (outlookWorkaroundEnabled) {
boolean isWindows = System.getProperty("os.name").toLowerCase().startsWith("windows");
if (isWindows) {
doOutlookWorkaround = JOptionPane.showConfirmDialog(null,
getMessageByKeySuffix(".isOutlook.message"),
getMessageByKeySuffix(".isOutlook.title"),
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)
== JOptionPane.YES_OPTION;
}
}
String[] mailToTokens = mailTo.split(";");
List<String> toAddrs = new ArrayList<String>(mailToTokens.length);
for (String mailToToken : mailToTokens)
{
String trimmedMailToToken = mailToToken.trim();
if (!StringUtils.isEmpty(trimmedMailToToken)) {
if (doOutlookWorkaround) {
// The standard is no prefix SMTP
// Outlook Express supposidly works with or without prefix SMTP
// Outlook (like in Office) works only with prefix SMTP
// Thunderbird works always without prefix SMTP.
// Thunderbirds works sometimes with prefix SMTP: it even differs from Vista to Vista
trimmedMailToToken = "SMTP:" + trimmedMailToToken;
}
toAddrs.add(trimmedMailToToken);
}
}
mail.setToAddrs(toAddrs);
}
Throwable errorException = info.getErrorException();
Object[] messageParams;
if (errorException != null) {
messageParams = new Object[] {
errorException,
getStackTraceString(errorException)
};
} else {
messageParams = new Object[] {
info.getBasicErrorMessage(),
info.getDetailedErrorMessage()
};
}
String subject = getMessageByKeySuffix(".subject", messageParams);
mail.setSubject(subject);
String body = getMessageByKeySuffix(".body", messageParams);
mail.setBody(body);
try {
Desktop.mail(mail);
} catch (LinkageError e) {
// Thrown by JDIC 0.9.3 on linux (and probably windows too) when native jars are not used properly