[jboss-svn-commits] JBL Code SVN: r5827 - labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Aug 12 11:16:22 EDT 2006


Author: tfennelly
Date: 2006-08-12 11:16:20 -0400 (Sat, 12 Aug 2006)
New Revision: 5827

Modified:
   labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/Email.java
Log:
Put a check around the SMTP_AUTH Sys property read before storing it in the properties hash

Modified: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/Email.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/Email.java	2006-08-12 15:15:13 UTC (rev 5826)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/Email.java	2006-08-12 15:16:20 UTC (rev 5827)
@@ -30,6 +30,7 @@
 import javax.mail.*;
 import javax.mail.internet.*;
 
+import org.apache.log4j.Logger;
 import org.jboss.soa.esb.common.SystemProperties;
 import org.jboss.soa.esb.util.*;
 
@@ -57,7 +58,12 @@
  * @author: Heuristica - Buenos Aires - Argentina
  */
 public class Email {
+	
 	/**
+	 * Class logger.
+	 */
+	private static Logger logger = Logger.getLogger(Email.class);
+	/**
 	 * DomElement attribute : will be the contents of the From: field in the
 	 * outgoing message
 	 */
@@ -363,7 +369,13 @@
 		Properties oMailP = new Properties();
 		oMailP.setProperty("mail.smtp.host", SystemProperties.getSmtpHost());
 		String sAuth = SystemProperties.getSmtpAuth();
-		oMailP.setProperty("mail.smtp.auth", sAuth);
+		if(sAuth != null) {
+			if(!sAuth.trim().equals("")) {
+				logger.warn("'" + SystemProperties.SMTP_AUTH + "' set to an empty value.");
+			}
+			oMailP.setProperty("mail.smtp.auth", sAuth);
+		}
+		
 		try {
 			String sPort = SystemProperties.getSmtpPort();			
 			this.from = SystemProperties.getSmtpFrom();
@@ -372,10 +384,9 @@
 		} 
 		catch (Exception e) { /* OK just leave standard port */ }
 
-
+		logger.info("Initialising mail server sesson. Properties: " + oMailP);
 		javax.mail.Session oMailSess = javax.mail.Session.getDefaultInstance(oMailP, oAuth);
 		
-		
 		return oMailSess;
 	}
     




More information about the jboss-svn-commits mailing list