Fixed try/catch statement in ContactMailController

This commit is contained in:
rjy7 2010-05-19 21:31:17 +00:00
parent eea97d50e9
commit a005d26f1c

View file

@ -87,6 +87,7 @@ public class ContactMailController extends FreeMarkerHttpServlet {
String validationMessage = validateInput(webusername, webuseremail, String validationMessage = validateInput(webusername, webuseremail,
comments); comments);
if (validationMessage != null) { if (validationMessage != null) {
// rjy7 We should reload the form, not go to the error page! // rjy7 We should reload the form, not go to the error page!
body.put("errorMessage", body.put("errorMessage",
@ -168,16 +169,15 @@ public class ContactMailController extends FreeMarkerHttpServlet {
String msgText = composeEmail(webusername, webuseremail, comments, String msgText = composeEmail(webusername, webuseremail, comments,
deliveryfrom, originalReferer, vreq.getRemoteAddr()); deliveryfrom, originalReferer, vreq.getRemoteAddr());
// debugging // Write the email to a backup file
FileWriter fw = null;
try { try {
fw = new FileWriter(context.getRealPath(EMAIL_BACKUP_FILE_PATH),true); FileWriter fw = new FileWriter(context.getRealPath(EMAIL_BACKUP_FILE_PATH),true);
PrintWriter outFile = new PrintWriter(fw);
writeBackupCopy(outFile, msgText, spamReason);
} }
catch (IOException e){ catch (IOException e){
LOG.error("Can't open file to write email backup"); LOG.error("Can't open file to write email backup");
} }
PrintWriter outFile = new PrintWriter(fw);
writeBackupCopy(outFile, msgText, spamReason);
// Set the smtp host // Set the smtp host
Properties props = System.getProperties(); Properties props = System.getProperties();