String recipient = ConfigurationManager
.getProperty("alert.recipient");
if (recipient != null)
{
Email email = ConfigurationManager.getEmail(I18nUtil.getEmailFilename(locale, "internal_error"));
email.addRecipient(recipient);
email.addArgument(ConfigurationManager
.getProperty("dspace.url"));
email.addArgument(new Date());
email.addArgument(request.getSession().getId());
email.addArgument(logInfo);
String stackTrace;
if (exception != null)
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
exception.printStackTrace(pw);
pw.flush();
stackTrace = sw.toString();
}
else
{
stackTrace = "No exception";
}
email.addArgument(stackTrace);
try
{
user = c.getCurrentUser();
}
catch (Exception e)
{
log.warn("No context, the database might be down or the connection pool exhausted.");
}
if (user != null)
{
email.addArgument(user.getFullName() + " (" + user.getEmail() + ")");
}
else
{
email.addArgument("Anonymous");
}
email.addArgument(request.getRemoteAddr());
email.send();
}
}
catch (Exception e)
{
// Not much we can do here!