commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ep...@apache.org
Subject cvs commit: jakarta-commons-sandbox/email/src/java/org/apache/commons/mail MultiPartEmail.java Email.java MailMessage.java DefaultAuthenticator.java HtmlEmail.java EmailAttachment.java
Date Mon, 25 Oct 2004 16:32:28 GMT
epugh       2004/10/25 09:32:28

  Modified:    email/src/test/org/apache/commons/mail HtmlEmailTest.java
                        EmailTest.java DefaultAuthenticatorTest.java
                        EmailAttachmentTest.java MultiPartEmailTest.java
               email/src/java/org/apache/commons/mail MultiPartEmail.java
                        Email.java MailMessage.java
                        DefaultAuthenticator.java HtmlEmail.java
                        EmailAttachment.java
  Log:
  Bug 31881 Style only changes
  
  Revision  Changes    Path
  1.3       +47 -29    jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/HtmlEmailTest.java
  
  Index: HtmlEmailTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/HtmlEmailTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HtmlEmailTest.java	24 Oct 2004 17:06:52 -0000	1.2
  +++ HtmlEmailTest.java	25 Oct 2004 16:32:27 -0000	1.3
  @@ -1,3 +1,18 @@
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation
  + *
  + * Licensed under the Apache License, Version 2.0 ( the "License" );
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *     http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   package org.apache.commons.mail;
   
   import java.io.File;
  @@ -15,7 +30,10 @@
   import com.dumbster.smtp.SimpleSmtpServer;
   
   /**
  - * JUnit test case for HtmlEmailTest
  + * JUnit test case for HtmlEmail Class
  + *
  + * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
  + * @version $Id$
    */
   
   public class HtmlEmailTest extends TestCase
  @@ -23,10 +41,10 @@
       /** */
       private MockHtmlEmailConcrete email = null;
   
  -	/** */
  -   private SimpleSmtpServer fakeMailServer = null;
  +    /** */
  +    private SimpleSmtpServer fakeMailServer = null;
   
  -   /** URL to used to test URL attachmetns (Must be valid) */
  +    /** URL to used to test URL attachmetns (Must be valid) */
       private String strTestURL = EmailConfiguration.TEST_URL;
       /** Mail server used for testing */
       private String strTestMailServer = EmailConfiguration.MAIL_SERVER;
  @@ -148,29 +166,29 @@
       /** */
       public void testSend()
       {
  -		// start the fake email server
  -		this.fakeMailServer = SimpleSmtpServer.start(25);
  +        // start the fake email server
  +        this.fakeMailServer = SimpleSmtpServer.start(25);
  +
  +        EmailAttachment attachment = new EmailAttachment();
  +        File testFile = null;
   
  -		EmailAttachment attachment = new EmailAttachment();
  -		File testFile = null;
  -		
  -		try
  -		{
  -			 /** File to used to test file attachmetns (Must be valid) */
  -			 testFile = File.createTempFile("commons-email-testfile", ".txt");
  -		}
  -		catch (IOException e)
  -		{
  -			e.printStackTrace();
  -			fail("Test file cannot be found");
  -		}
  +        try
  +        {
  +            /** File to used to test file attachmetns (Must be valid) */
  +            testFile = File.createTempFile("commons-email-testfile", ".txt");
  +        }
  +        catch (IOException e)
  +        {
  +            e.printStackTrace();
  +            fail("Test file cannot be found");
  +        }
   
           // ====================================================================
           // Test Success
  -        // ==================================================================== }
  -		try
  -		{
  -			 /** File to used to test file attachmetns (Must be valid) */
  +        // ====================================================================
  +        try
  +        {
  +            /** File to used to test file attachmetns (Must be valid) */
               attachment.setName("Test Attachment");
               attachment.setDescription("Test Attachment Desc");
               attachment.setPath(testFile.getAbsolutePath());
  @@ -203,11 +221,11 @@
   
               this.email.send();
           }
  -		catch (MessagingException e)
  -		{
  -			e.printStackTrace();
  -			fail("Unexpected exception thrown");
  -		}
  +        catch (MessagingException e)
  +        {
  +            e.printStackTrace();
  +            fail("Unexpected exception thrown");
  +        }
           catch (MalformedURLException e)
           {
               e.printStackTrace();
  @@ -240,7 +258,7 @@
           }
           // ====================================================================
           // Test Success
  -        // ==================================================================== }
  +        // ====================================================================
           try
           {
               this.email = new MockHtmlEmailConcrete();
  
  
  
  1.3       +41 -22    jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/EmailTest.java
  
  Index: EmailTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/EmailTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EmailTest.java	24 Oct 2004 17:06:52 -0000	1.2
  +++ EmailTest.java	25 Oct 2004 16:32:27 -0000	1.3
  @@ -1,3 +1,18 @@
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation
  + *
  + * Licensed under the Apache License, Version 2.0 ( the "License" );
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *     http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   package org.apache.commons.mail;
   
   import java.io.UnsupportedEncodingException;
  @@ -20,7 +35,10 @@
   import com.dumbster.smtp.SimpleSmtpServer;
   
   /**
  - * JUnit test case for EmailTest
  + * JUnit test case for Email Class
  + *
  + * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
  + * @version $Id$
    */
   
   public class EmailTest extends TestCase
  @@ -50,23 +68,23 @@
           super(name);
       }
   
  -	/** */
  -	protected void setUp()
  -	{
  -		// reusable objects to be used across multiple tests
  -		this.email = new MockEmailConcrete();
  -	}
  -
  -	/** */
  -	protected void tearDown()
  -	{
  -		// stop the fake email server (if started)
  -		if (this.fakeMailServer != null && !this.fakeMailServer.isStopped())
  -		{
  -			this.fakeMailServer.stop();
  -			this.fakeMailServer = null;
  -		}
  -	}
  +    /** */
  +    protected void setUp()
  +    {
  +        // reusable objects to be used across multiple tests
  +        this.email = new MockEmailConcrete();
  +    }
  +
  +    /** */
  +    protected void tearDown()
  +    {
  +        // stop the fake email server (if started)
  +        if (this.fakeMailServer != null && !this.fakeMailServer.isStopped())
  +        {
  +            this.fakeMailServer.stop();
  +            this.fakeMailServer = null;
  +        }
  +    }
   
       /** */
       public void testGetSetDebug()
  @@ -89,7 +107,8 @@
           String strPassword = "user.pwd";
           this.email.setAuthentication(strUsername, strPassword);
   
  -        // this is cast into DefaultAuthenticator for convenience and give us access to the getPasswordAuthentication fn
  +        // this is cast into DefaultAuthenticator for convenience 
  +        // and give us access to the getPasswordAuthentication fn
           DefaultAuthenticator retrievedAuth =
               (DefaultAuthenticator) this.email.getAuthenticator();
   
  @@ -872,7 +891,7 @@
           testEmailValid.add("Name1 <me@home.com>");
           testEmailValid.add("\"joe.doe@apache.org\" <joe.doe@apache.org>");
           testEmailValid.add(
  -            "\"someone_here@work-address.com.au\" <someone_here@work-address.com.au>");
  +                "\"someone_here@work-address.com.au\" <someone_here@work-address.com.au>");
   
           try
           {
  @@ -1569,8 +1588,8 @@
       /** */
       public void testSendEx()
       {
  -		// start the fake email server
  -		this.fakeMailServer = SimpleSmtpServer.start(25);
  +        // start the fake email server
  +        this.fakeMailServer = SimpleSmtpServer.start(25);
   
           // ====================================================================
           // Test Exceptions (in getMailSession)
  
  
  
  1.3       +4 -1      jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/DefaultAuthenticatorTest.java
  
  Index: DefaultAuthenticatorTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/DefaultAuthenticatorTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultAuthenticatorTest.java	24 Oct 2004 17:06:52 -0000	1.2
  +++ DefaultAuthenticatorTest.java	25 Oct 2004 16:32:27 -0000	1.3
  @@ -5,7 +5,10 @@
   import junit.framework.TestCase;
   
   /**
  - * JUnit test case for DefaultAuthenticatorTest
  + * JUnit test case for DefaultAuthenticator Class
  + *
  + * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
  + * @version $Id$
    */
   
   public class DefaultAuthenticatorTest extends TestCase
  
  
  
  1.3       +19 -1     jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/EmailAttachmentTest.java
  
  Index: EmailAttachmentTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/EmailAttachmentTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EmailAttachmentTest.java	24 Oct 2004 17:06:52 -0000	1.2
  +++ EmailAttachmentTest.java	25 Oct 2004 16:32:27 -0000	1.3
  @@ -1,3 +1,18 @@
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation
  + *
  + * Licensed under the Apache License, Version 2.0 ( the "License" );
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *     http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   package org.apache.commons.mail;
   
   import java.net.MalformedURLException;
  @@ -6,7 +21,10 @@
   import junit.framework.TestCase;
   
   /**
  - * JUnit test case for EmailAttachmentTest
  + * JUnit test case for EmailAttachment Class
  + *
  + * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
  + * @version $Id$
    */
   
   public class EmailAttachmentTest extends TestCase
  
  
  
  1.3       +22 -2     jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/MultiPartEmailTest.java
  
  Index: MultiPartEmailTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/MultiPartEmailTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MultiPartEmailTest.java	24 Oct 2004 17:06:52 -0000	1.2
  +++ MultiPartEmailTest.java	25 Oct 2004 16:32:27 -0000	1.3
  @@ -1,6 +1,22 @@
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation
  + *
  + * Licensed under the Apache License, Version 2.0 ( the "License" );
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *     http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   package org.apache.commons.mail;
   
   import java.io.File;
  +import java.io.IOException;
   import java.net.MalformedURLException;
   import java.net.URL;
   import java.util.Hashtable;
  @@ -17,14 +33,18 @@
   import com.dumbster.smtp.SimpleSmtpServer;
   
   /**
  - * JUnit test case for MultiPartEmailTest
  + * JUnit test case for MultiPartEmail Class
  + *
  + * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
  + * @version $Id$
    */
   
   public class MultiPartEmailTest extends TestCase
   {
  +    /** Fake Smtp server provided by Dumbster */
       private SimpleSmtpServer fakeMailServer = null;
       /** */
  -    private MockMultiPartEmailConcrete email    = null;
  +    private MockMultiPartEmailConcrete email = null;
       /** File to used to test file attachmetns (Must be valid) */
       private File testFile;
       /** URL to used to test URL attachmetns (Must be valid) */
  
  
  
  1.8       +78 -44    jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/MultiPartEmail.java
  
  Index: MultiPartEmail.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/MultiPartEmail.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MultiPartEmail.java	24 Oct 2004 17:27:21 -0000	1.7
  +++ MultiPartEmail.java	25 Oct 2004 16:32:28 -0000	1.8
  @@ -42,6 +42,7 @@
    * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
    * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
    * @author <a href="mailto:unknown">Regis Koenig</a>
  + * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
    * @version $Id$
    */
   public class MultiPartEmail extends Email
  @@ -54,21 +55,22 @@
   
       /** The MIME subtype. */
       private String subType = null;
  -    
  -    
  +
       /** Indicates if the message has been initialized */
       private boolean initialized = false;
   
       /**
        * Set the MIME subtype of the email.
  +     * @param aSubType MIME subtype of the email
        */
  -    public void setSubType(String subType)
  +    public void setSubType(String aSubType)
       {
  -        this.subType = subType;
  +        this.subType = aSubType;
       }
   
       /**
        * Get the MIME subtype of the email.
  +     * @return MIME subtype of the email
        */
       public String getSubType()
       {
  @@ -80,9 +82,11 @@
        * @param content The content.
        * @param contentType The content type.
        * @return An Email.
  -     * @exception MessagingException
  +     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     *  for defintions
        */
  -    public Email addPart(String content, String contentType) throws MessagingException
  +    public Email addPart(String content, String contentType)
  +        throws MessagingException
       {
           MimeBodyPart bodyPart = new MimeBodyPart();
           bodyPart.setContent(content, contentType);
  @@ -93,9 +97,10 @@
   
       /**
        * Add a new part to the email.
  -     * @param part The MimeMultipart.
  +     * @param multipart The MimeMultipart.
        * @return An Email.
  -     * @exception MessagingException
  +     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     *  for defintions
        */
       public Email addPart(MimeMultipart multipart) throws MessagingException
       {
  @@ -106,11 +111,11 @@
           return this;
       }
   
  -    
       /**
        * Initialize the multipart email.
        *
  -     * @exception MessagingException
  +     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     *  for defintions
        */
       private void init() throws MessagingException
       {
  @@ -134,7 +139,8 @@
        *
        * @param msg A String.
        * @return An Email.
  -     * @exception MessagingException
  +     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     *  for defintions
        */
       public Email setMsg(String msg) throws MessagingException
       {
  @@ -152,7 +158,8 @@
       /**
        * Sends the mail message
        *
  -     * @throws MessagingException
  +     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     *  for defintions
        */
       public void send() throws MessagingException
       {
  @@ -172,18 +179,19 @@
               {
                   // do nothing here.  content will be set to an empty string
                   // as a result.
  +                content = null;
               }
   
               if (subType != null)
               {
                   getContainer().setSubType(subType);
               }
  -        
  +
           }
           if (subType != null)
           {
               getContainer().setSubType(subType);
  -        }      
  +        }
   
           super.send();
       }
  @@ -193,10 +201,11 @@
        *
        * @param attachment An EmailAttachment.
        * @return A MultiPartEmail.
  -     * @exception MessagingException
  +     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     *  for defintions
        */
       public MultiPartEmail attach(EmailAttachment attachment)
  -            throws MessagingException
  +        throws MessagingException
       {
           MultiPartEmail result = null;
   
  @@ -210,22 +219,31 @@
                   File file = new File(fileName);
                   if (!file.exists())
                   {
  -                    throw new IOException("\""+fileName + "\" does not exist");
  +                    throw new IOException(
  +                        "\"" + fileName + "\" does not exist");
                   }
  -                result = attach(new FileDataSource(file), attachment.getName(),
  +                result =
  +                    attach(
  +                        new FileDataSource(file),
  +                        attachment.getName(),
                           attachment.getDescription(),
                           attachment.getDisposition());
               }
               catch (Exception e)
               {
  -                throw new MessagingException("Cannot attach file \""
  -                        +fileName+"\"", e);
  +                throw new MessagingException(
  +                    "Cannot attach file \"" + fileName + "\"",
  +                    e);
               }
           }
           else
           {
  -            result = attach(url, attachment.getName(),
  -                    attachment.getDescription(), attachment.getDisposition());
  +            result =
  +                attach(
  +                    url,
  +                    attachment.getName(),
  +                    attachment.getDescription(),
  +                    attachment.getDisposition());
           }
   
           return result;
  @@ -239,10 +257,11 @@
        * @param name The name field for the attachment.
        * @param description A description for the attachment.
        * @return A MultiPartEmail.
  -     * @exception MessagingException
  +     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     *  for defintions
        */
       public MultiPartEmail attach(URL url, String name, String description)
  -            throws MessagingException
  +        throws MessagingException
       {
           return attach(url, name, description, EmailAttachment.ATTACHMENT);
       }
  @@ -255,14 +274,17 @@
        * @param description A description for the attachment.
        * @param disposition Either mixed or inline.
        * @return A MultiPartEmail.
  -     * @exception MessagingException
  +     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     *  for defintions
        */
  -    public MultiPartEmail attach(URL url, String name, String description,
  -                                 String disposition)
  -            throws MessagingException
  +    public MultiPartEmail attach(
  +        URL url,
  +        String name,
  +        String description,
  +        String disposition)
  +        throws MessagingException
       {
  -        return attach(
  -                new URLDataSource(url), name, description, disposition);
  +        return attach(new URLDataSource(url), name, description, disposition);
       }
   
       /**
  @@ -272,10 +294,14 @@
        * @param name The name field for the attachment.
        * @param description A description for the attachment.
        * @return A MultiPartEmail.
  -     * @exception MessagingException
  +     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     *  for defintions
        */
  -    public MultiPartEmail attach(DataSource ds, String name, String description)
  -            throws MessagingException
  +    public MultiPartEmail attach(
  +        DataSource ds,
  +        String name,
  +        String description)
  +        throws MessagingException
       {
           return attach(ds, name, description, EmailAttachment.ATTACHMENT);
       }
  @@ -288,11 +314,15 @@
        * @param description A description for the attachement.
        * @param disposition Either mixed or inline.
        * @return A MultiPartEmail.
  -     * @exception MessagingException
  +     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     *  for defintions
        */
  -    public MultiPartEmail attach(DataSource ds, String name,
  -                                 String description, String disposition)
  -            throws MessagingException
  +    public MultiPartEmail attach(
  +        DataSource ds,
  +        String name,
  +        String description,
  +        String disposition)
  +        throws MessagingException
       {
           MimeBodyPart mbp = new MimeBodyPart();
           getContainer().addBodyPart(mbp);
  @@ -313,19 +343,21 @@
        * Gets first body part of the message.
        *
        * @return The primary body part.
  -     * @throws MessagingException message could not be initialized
  +     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     *  for defintions
        */
       protected MimeBodyPart getPrimaryBodyPart() throws MessagingException
       {
  -        if(!initialized) {
  +        if (!initialized)
  +        {
               init();
  -        }        
  +        }
   
           if (primaryBodyPart == null)
           {
               primaryBodyPart = new MimeBodyPart();
               container.addBodyPart(primaryBodyPart);
  -        }        
  +        }
           return primaryBodyPart;
       }
   
  @@ -333,11 +365,13 @@
        * Gets the message container.
        *
        * @return The message container.
  -     * @throws MessagingException message could not be initialized
  +     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     *  for defintions
        */
       protected MimeMultipart getContainer() throws MessagingException
       {
  -        if(!initialized) {
  +        if (!initialized)
  +        {
               init();
           }
           return container;
  
  
  
  1.21      +264 -257  jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/Email.java
  
  Index: Email.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/Email.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Email.java	24 Oct 2004 17:46:38 -0000	1.20
  +++ Email.java	25 Oct 2004 16:32:28 -0000	1.21
  @@ -50,56 +50,58 @@
    * @author <a href="mailto:unknown">Regis Koenig</a>
    * @author <a href="mailto:colin.chalmers@maxware.nl">Colin Chalmers</a>
    * @author <a href="mailto:matthias@wessendorf.net">Matthias Wessendorf</a>
  + * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
    * @version $Id$
    */
   public abstract class Email
   {
       /** Constants used by Email classes. */
  -    
  +
       /** */
  -    public static final String SENDER_EMAIL     = "sender.email";
  +    public static final String SENDER_EMAIL = "sender.email";
       /** */
  -    public static final String SENDER_NAME      = "sender.name";
  +    public static final String SENDER_NAME = "sender.name";
       /** */
  -    public static final String RECEIVER_EMAIL   = "receiver.email";
  +    public static final String RECEIVER_EMAIL = "receiver.email";
       /** */
  -    public static final String RECEIVER_NAME    = "receiver.name";
  +    public static final String RECEIVER_NAME = "receiver.name";
       /** */
  -    public static final String EMAIL_SUBJECT    = "email.subject";
  +    public static final String EMAIL_SUBJECT = "email.subject";
       /** */
  -    public static final String EMAIL_BODY       = "email.body";
  +    public static final String EMAIL_BODY = "email.body";
       /** */
  -    public static final String CONTENT_TYPE     = "content.type";
  +    public static final String CONTENT_TYPE = "content.type";
   
       /** */
  -    public static final String MAIL_HOST        = "mail.host";
  +    public static final String MAIL_HOST = "mail.host";
       /** */
  -    public static final String MAIL_PORT        = "mail.smtp.port";
  +    public static final String MAIL_PORT = "mail.smtp.port";
       /** */
  -    public static final String MAIL_SMTP_FROM   = "mail.smtp.from";
  +    public static final String MAIL_SMTP_FROM = "mail.smtp.from";
       /** */
  -    public static final String MAIL_SMTP_AUTH   = "mail.smtp.auth";
  +    public static final String MAIL_SMTP_AUTH = "mail.smtp.auth";
       /** */
  -    public static final String MAIL_TRANSPORT_PROTOCOL = "mail.transport.protocol";
  +    public static final String MAIL_TRANSPORT_PROTOCOL =
  +        "mail.transport.protocol";
       /** */
  -    public static final String SMTP             = "smtp";
  +    public static final String SMTP = "smtp";
       /** */
  -    public static final String TEXT_HTML        = "text/html";
  +    public static final String TEXT_HTML = "text/html";
       /** */
  -    public static final String TEXT_PLAIN       = "text/plain";
  +    public static final String TEXT_PLAIN = "text/plain";
       /** */
  -    public static final String ATTACHMENTS      = "attachments";
  +    public static final String ATTACHMENTS = "attachments";
       /** */
  -    public static final String FILE_SERVER      = "file.server";
  +    public static final String FILE_SERVER = "file.server";
       /** */
  -    public static final String MAIL_DEBUG       = "mail.debug";
  +    public static final String MAIL_DEBUG = "mail.debug";
   
       /** */
  -    public static final String KOI8_R           = "koi8-r";
  +    public static final String KOI8_R = "koi8-r";
       /** */
  -    public static final String ISO_8859_1       = "iso-8859-1";
  +    public static final String ISO_8859_1 = "iso-8859-1";
       /** */
  -    public static final String US_ASCII         = "us-ascii";
  +    public static final String US_ASCII = "us-ascii";
   
       /** The email message to send. */
       protected MimeMessage message = null;
  @@ -127,9 +129,9 @@
   
       /** Sent date */
       protected Date sentDate = null;
  -    
  +
       /** The Session to mail with */
  -    private Session session = null;    
  +    private Session session = null;
   
       /**
        * Instance of an <code>Authenticator</code> object that will be used
  @@ -141,21 +143,22 @@
        * The hostname of the mail server with which to connect. If null will try
        * to get property from system.properties. If still null, quit
        */
  -    protected String hostName   = null;
  +    protected String hostName = null;
   
       /**
  -     * The port number of the mail server to connect to.  Defaults to the standard port ( 25 ).
  +     * The port number of the mail server to connect to.  
  +     * Defaults to the standard port ( 25 ).
        */
  -    protected String smtpPort   = "25";
  +    protected String smtpPort = "25";
   
       /** List of "to" email adresses */
  -    protected ArrayList toList  = new ArrayList();
  +    protected ArrayList toList = new ArrayList();
   
       /** List of "cc" email adresses */
  -    protected ArrayList ccList  = new ArrayList();
  +    protected ArrayList ccList = new ArrayList();
   
       /** List of "bcc" email adresses */
  -    protected ArrayList bccList     = new ArrayList();
  +    protected ArrayList bccList = new ArrayList();
   
       /** List of "replyTo" email adresses */
       protected ArrayList replyList = new ArrayList();
  @@ -167,31 +170,31 @@
        * or  2( high ) 3( normal ) 4( low ) and 5( lowest )
        * Disposition-Notification-To: user@domain.net
        */
  -    protected Hashtable headers     = new Hashtable();
  +    protected Hashtable headers = new Hashtable();
   
       /**
        * Used to determine wether to use pop3 before smtp, and if so the settings.
        */
  -    
  +
       /** */
  -    protected boolean popBeforeSmtp     = false;
  +    protected boolean popBeforeSmtp = false;
       /** */
  -    protected String popHost            = null;
  +    protected String popHost = null;
       /** */
  -    protected String popUsername        = null;
  +    protected String popUsername = null;
       /** */
  -    protected String popPassword        = null;
  +    protected String popPassword = null;
   
       /**
        * Setting to true will enable the display of debug information.
        *
        * @param d A boolean.
        */
  -    public void setDebug( boolean d )
  +    public void setDebug(boolean d)
       {
           this.debug = d;
       }
  -    
  +
       /**
        * Sets the userName and password if authentication is needed.  If this
        * method is not used, no authentication will be performed.
  @@ -204,10 +207,10 @@
        * @see DefaultAuthenticator
        * @see #setAuthenticator
        */
  -    public void setAuthentication( String userName, String password )
  +    public void setAuthentication(String userName, String password)
       {
  -        this.authenticator = new DefaultAuthenticator( userName, password );
  -        this.setAuthenticator( this.authenticator );
  +        this.authenticator = new DefaultAuthenticator(userName, password);
  +        this.setAuthenticator(this.authenticator);
       }
   
       /**
  @@ -220,7 +223,7 @@
        * @param newAuthenticator the <code>Authenticator</code> object.
        * @see Authenticator
        */
  -    public void setAuthenticator( Authenticator newAuthenticator )
  +    public void setAuthenticator(Authenticator newAuthenticator)
       {
           this.authenticator = newAuthenticator;
       }
  @@ -230,7 +233,7 @@
        *
        * @param newCharset A String.
        */
  -    public void setCharset( String newCharset )
  +    public void setCharset(String newCharset)
       {
           this.charset = newCharset;
       }
  @@ -240,7 +243,7 @@
        *
        * @param aMimeMultipart aMimeMultipart
        */
  -    public void setContent( MimeMultipart aMimeMultipart )
  +    public void setContent(MimeMultipart aMimeMultipart)
       {
           this.emailBody = aMimeMultipart;
       }
  @@ -251,10 +254,10 @@
        * @param   aObject aObject
        * @param   aContentType aContentType
        */
  -    public void setContent( Object aObject, String aContentType )
  +    public void setContent(Object aObject, String aContentType)
       {
           this.content = aObject;
  -        if ( !StringUtils.isNotEmpty( aContentType ) )
  +        if (!StringUtils.isNotEmpty(aContentType))
           {
               this.contentType = null;
           }
  @@ -265,21 +268,23 @@
   
               // set the charset if the input was properly formed
               String strMarker = "; charset=";
  -            int charsetPos = aContentType.toLowerCase().indexOf( strMarker );
  -            
  -            if ( charsetPos != -1 )
  +            int charsetPos = aContentType.toLowerCase().indexOf(strMarker);
  +
  +            if (charsetPos != -1)
               {
                   // find the next space (after the marker)
                   charsetPos += strMarker.length();
  -                int intCharsetEnd = aContentType.toLowerCase().indexOf( " ", charsetPos );
  -                
  -                if ( intCharsetEnd != -1 )
  +                int intCharsetEnd =
  +                    aContentType.toLowerCase().indexOf(" ", charsetPos);
  +
  +                if (intCharsetEnd != -1)
                   {
  -                    this.charset = aContentType.substring( charsetPos, intCharsetEnd );
  +                    this.charset =
  +                        aContentType.substring(charsetPos, intCharsetEnd);
                   }
                   else
                   {
  -                    this.charset = aContentType.substring( charsetPos );
  +                    this.charset = aContentType.substring(charsetPos);
                   }
               }
           }
  @@ -290,7 +295,7 @@
        *
        * @param   aHostName aHostName
        */
  -    public void setHostName( String aHostName )
  +    public void setHostName(String aHostName)
       {
           this.hostName = aHostName;
       }
  @@ -299,62 +304,64 @@
        * Set the port number of the outgoing mail server.
        * @param   aPortNumber aPortNumber
        */
  -    public void setSmtpPort( int aPortNumber )
  +    public void setSmtpPort(int aPortNumber)
       {
  -        if ( aPortNumber < 1 )
  +        if (aPortNumber < 1)
           {
  -            throw new IllegalArgumentException( 
  -                                "Cannot connect to a port number that is less than 1 ( "
  -                                + aPortNumber
  -                                + " )" );
  +            throw new IllegalArgumentException(
  +                "Cannot connect to a port number that is less than 1 ( "
  +                    + aPortNumber
  +                    + " )");
           }
  -        
  -        this.smtpPort = new Integer( aPortNumber ).toString();
  +
  +        this.smtpPort = new Integer(aPortNumber).toString();
       }
   
       /**
        * Supply a mail Session object to use
  -     *
  +     * @param aSession mail session to be used
        */
  -    public void setMailSession(Session session)
  +    public void setMailSession(Session aSession)
       {
  -        this.session = session;
  -   }    
  +        this.session = aSession;
  +    }
       /**
        * Initialise a mailsession object
        *
        * @return A Session.
        * @throws MessagingException thrown when host name was not set
        */
  -    private Session getMailSession() 
  -        throws MessagingException
  +    private Session getMailSession() throws MessagingException
       {
  -        if (session == null){
  +        if (this.session == null)
  +        {
               Properties properties = new Properties(System.getProperties());
  -            properties.setProperty( MAIL_TRANSPORT_PROTOCOL, SMTP );
  +            properties.setProperty(MAIL_TRANSPORT_PROTOCOL, SMTP);
   
  -            if ( !StringUtils.isNotEmpty( this.hostName ) )
  +            if (!StringUtils.isNotEmpty(this.hostName))
               {
  -                this.hostName = properties.getProperty( MAIL_HOST );
  +                this.hostName = properties.getProperty(MAIL_HOST);
               }
   
  -            if ( !StringUtils.isNotEmpty( this.hostName ) )
  +            if (!StringUtils.isNotEmpty(this.hostName))
               {
  -                throw new MessagingException( "Cannot find valid hostname for mail session" );
  +                throw new MessagingException(
  +                    "Cannot find valid hostname for mail session");
               }
   
  -            properties.setProperty( MAIL_PORT, smtpPort );
  -            properties.setProperty( MAIL_HOST, hostName );
  -            properties.setProperty( MAIL_DEBUG, String.valueOf( this.debug ) );
  +            properties.setProperty(MAIL_PORT, smtpPort);
  +            properties.setProperty(MAIL_HOST, hostName);
  +            properties.setProperty(MAIL_DEBUG, String.valueOf(this.debug));
   
  -            if ( this.authenticator != null )
  +            if (this.authenticator != null)
               {
  -            properties.setProperty( MAIL_SMTP_AUTH, "true" );
  +                properties.setProperty(MAIL_SMTP_AUTH, "true");
               }
   
  -            Session session = Session.getDefaultInstance( properties, this.authenticator );
  +            this.session =
  +                Session.getDefaultInstance(properties, this.authenticator);
           }
  -        return session;
  +        return this.session;
       }
   
       /**
  @@ -362,12 +369,13 @@
        * @param strEmail The email address to be validated
        * @throws MessagingException if the email address is not in a valid format
        */
  -    private void validateEmailAddress( String strEmail )
  +    private void validateEmailAddress(String strEmail)
           throws MessagingException
       {
  -        if ( !StringUtils.isNotEmpty( strEmail ) || !EmailValidator.getInstance().isValid( strEmail ) )
  +        if (!StringUtils.isNotEmpty(strEmail)
  +            || !EmailValidator.getInstance().isValid(strEmail))
           {
  -            throw new MessagingException( "Address " + strEmail + " is invalid" );
  +            throw new MessagingException("Address " + strEmail + " is invalid");
           }
       }
   
  @@ -378,10 +386,9 @@
        * @return An Email.
        * @throws MessagingException Indicates an invalid email address
        */
  -    public Email setFrom( String email ) 
  -        throws MessagingException
  +    public Email setFrom(String email) throws MessagingException
       {
  -        return setFrom( email, null );
  +        return setFrom(email, null);
       }
   
       /**
  @@ -392,43 +399,43 @@
        * @return An Email.
        * @throws MessagingException Indicates an invalid email address
        */
  -    public Email setFrom( String email, String name ) 
  -        throws MessagingException
  +    public Email setFrom(String email, String name) throws MessagingException
       {
           // validate the email address
  -        this.validateEmailAddress( email );
  +        this.validateEmailAddress(email);
   
           try
           {
               // check name input
  -            if ( !StringUtils.isNotEmpty( name ) )
  +            if (!StringUtils.isNotEmpty(name))
               {
                   name = email;
               }
  -            
  +
               // set/update the from address
  -            if ( this.fromAddress == null )
  +            if (this.fromAddress == null)
               {
  -                if ( this.charset != null && !this.charset.trim().equals( "" ) )
  +                if (this.charset != null && !this.charset.trim().equals(""))
                   {
  -                    this.fromAddress = new InternetAddress( email, name, this.charset );
  +                    this.fromAddress =
  +                        new InternetAddress(email, name, this.charset);
                   }
                   else
                   {
  -                    this.fromAddress = new InternetAddress( email, name );
  +                    this.fromAddress = new InternetAddress(email, name);
                   }
               }
               else
               {
  -                this.fromAddress.setAddress( email );
  -                this.fromAddress.setPersonal( name );
  +                this.fromAddress.setAddress(email);
  +                this.fromAddress.setPersonal(name);
               }
           }
  -        catch ( UnsupportedEncodingException e )
  +        catch (UnsupportedEncodingException e)
           {
  -            throw new MessagingException( "cannot set from", e );
  +            throw new MessagingException("cannot set from", e);
           }
  -        
  +
           return this;
       }
   
  @@ -439,10 +446,9 @@
        * @return An Email.
        * @throws MessagingException Indicates an invalid email address
        */
  -    public Email addTo( String email ) 
  -        throws MessagingException
  +    public Email addTo(String email) throws MessagingException
       {
  -        return addTo( email, null );
  +        return addTo(email, null);
       }
   
       /**
  @@ -453,31 +459,30 @@
        * @return An Email.
        * @throws MessagingException Indicates an invalid email address
        */
  -    public Email addTo( String email, String name ) 
  -        throws MessagingException
  +    public Email addTo(String email, String name) throws MessagingException
       {
           // validate the email address
  -        this.validateEmailAddress( email );
  +        this.validateEmailAddress(email);
   
           try
           {
  -            if ( !StringUtils.isNotEmpty( name ) )
  +            if (!StringUtils.isNotEmpty(name))
               {
                   name = email;
               }
   
  -            if ( !StringUtils.isNotEmpty( this.charset ) )
  +            if (!StringUtils.isNotEmpty(this.charset))
               {
  -                this.toList.add( new InternetAddress( email, name, this.charset ) );
  +                this.toList.add(new InternetAddress(email, name, this.charset));
               }
               else
               {
  -                this.toList.add( new InternetAddress( email, name ) );
  +                this.toList.add(new InternetAddress(email, name));
               }
           }
  -        catch ( UnsupportedEncodingException e )
  +        catch (UnsupportedEncodingException e)
           {
  -            throw new MessagingException( "cannot add to", e );
  +            throw new MessagingException("cannot add to", e);
           }
           return this;
       }
  @@ -489,15 +494,14 @@
        * @return An Email.
        * @throws MessagingException Indicates an invalid email address
        */
  -    public Email setTo( Collection aCollection )
  -        throws MessagingException
  +    public Email setTo(Collection aCollection) throws MessagingException
       {
  -        if ( aCollection == null || aCollection.isEmpty() )
  +        if (aCollection == null || aCollection.isEmpty())
           {
  -            throw new MessagingException( "Address List provided was invalid" );
  +            throw new MessagingException("Address List provided was invalid");
           }
   
  -        this.toList = new ArrayList( aCollection );
  +        this.toList = new ArrayList(aCollection);
           return this;
       }
   
  @@ -508,10 +512,9 @@
        * @return An Email.
        * @throws MessagingException Indicates an invalid email address
        */
  -    public Email addCc( String email ) 
  -        throws MessagingException
  +    public Email addCc(String email) throws MessagingException
       {
  -        return this.addCc( email, null );
  +        return this.addCc(email, null);
       }
   
       /**
  @@ -522,31 +525,30 @@
        * @return An Email.
        * @throws MessagingException Indicates an invalid email address
        */
  -    public Email addCc( String email, String name ) 
  -        throws MessagingException
  +    public Email addCc(String email, String name) throws MessagingException
       {
           // validate the email address
  -        this.validateEmailAddress( email );
  +        this.validateEmailAddress(email);
   
           try
           {
  -            if ( !StringUtils.isNotEmpty( name ) )
  +            if (!StringUtils.isNotEmpty(name))
               {
                   name = email;
               }
   
  -            if ( !StringUtils.isNotEmpty( this.charset ) )
  +            if (!StringUtils.isNotEmpty(this.charset))
               {
  -                this.ccList.add( new InternetAddress( email, name, this.charset ) );
  +                this.ccList.add(new InternetAddress(email, name, this.charset));
               }
               else
               {
  -                this.ccList.add( new InternetAddress( email, name ) );
  +                this.ccList.add(new InternetAddress(email, name));
               }
           }
  -        catch ( UnsupportedEncodingException e )
  +        catch (UnsupportedEncodingException e)
           {
  -            throw new MessagingException( "cannot add cc", e );
  +            throw new MessagingException("cannot add cc", e);
           }
   
           return this;
  @@ -559,15 +561,14 @@
        * @return An Email.
        * @throws MessagingException Indicates an invalid email address
        */
  -    public Email setCc( Collection aCollection )
  -        throws MessagingException
  +    public Email setCc(Collection aCollection) throws MessagingException
       {
  -        if ( aCollection == null || aCollection.isEmpty() )
  +        if (aCollection == null || aCollection.isEmpty())
           {
  -            throw new MessagingException( "Address List provided was invalid" );
  +            throw new MessagingException("Address List provided was invalid");
           }
   
  -        this.ccList = new ArrayList( aCollection );
  +        this.ccList = new ArrayList(aCollection);
           return this;
       }
   
  @@ -578,10 +579,9 @@
        * @return An Email.
        * @throws MessagingException Indicates an invalid email address
        */
  -    public Email addBcc( String email ) 
  -        throws MessagingException
  +    public Email addBcc(String email) throws MessagingException
       {
  -        return this.addBcc( email, null );
  +        return this.addBcc(email, null);
       }
   
       /**
  @@ -592,31 +592,31 @@
        * @return An Email.
        * @throws MessagingException Indicates an invalid email address
        */
  -    public Email addBcc( String email, String name ) 
  -        throws MessagingException
  +    public Email addBcc(String email, String name) throws MessagingException
       {
           // validate the email address
  -        this.validateEmailAddress( email );
  +        this.validateEmailAddress(email);
   
           try
           {
  -            if ( !StringUtils.isNotEmpty( name ) )
  +            if (!StringUtils.isNotEmpty(name))
               {
                   name = email;
               }
  -            if ( this.charset != null && !this.charset.trim().equals( "" ) )
  +            if (this.charset != null && !this.charset.trim().equals(""))
               {
  -                this.bccList.add( new InternetAddress( email, name, this.charset ) );
  +                this.bccList.add(
  +                    new InternetAddress(email, name, this.charset));
               }
               else
               {
  -                this.bccList.add( new InternetAddress( email, name ) );
  +                this.bccList.add(new InternetAddress(email, name));
               }
   
           }
  -        catch ( UnsupportedEncodingException e )
  +        catch (UnsupportedEncodingException e)
           {
  -            throw new MessagingException( "cannot add bcc", e );
  +            throw new MessagingException("cannot add bcc", e);
           }
   
           return this;
  @@ -629,15 +629,14 @@
        * @return  An Email.
        * @throws MessagingException Indicates an invalid email address
        */
  -    public Email setBcc( Collection aCollection )
  -        throws MessagingException
  +    public Email setBcc(Collection aCollection) throws MessagingException
       {
  -        if ( aCollection == null || aCollection.isEmpty() )
  +        if (aCollection == null || aCollection.isEmpty())
           {
  -            throw new MessagingException( "Address List provided was invalid" );
  +            throw new MessagingException("Address List provided was invalid");
           }
   
  -        this.bccList = new ArrayList( aCollection );
  +        this.bccList = new ArrayList(aCollection);
           return this;
       }
   
  @@ -648,10 +647,9 @@
        * @return An Email.
        * @throws MessagingException Indicates an invalid email address
        */
  -    public Email addReplyTo( String email ) 
  -        throws MessagingException
  +    public Email addReplyTo(String email) throws MessagingException
       {
  -        return this.addReplyTo( email, null );
  +        return this.addReplyTo(email, null);
       }
   
       /**
  @@ -662,31 +660,32 @@
        * @return An Email.
        * @throws MessagingException Indicates an invalid email address
        */
  -    public Email addReplyTo( String email, String name )
  +    public Email addReplyTo(String email, String name)
           throws MessagingException
       {
           // validate the email address
  -        this.validateEmailAddress( email );
  +        this.validateEmailAddress(email);
   
           try
           {
  -            if ( !StringUtils.isNotEmpty( name ) )
  +            if (!StringUtils.isNotEmpty(name))
               {
                   name = email;
               }
   
  -            if ( !StringUtils.isNotEmpty( this.charset ) )
  +            if (!StringUtils.isNotEmpty(this.charset))
               {
  -                this.replyList.add( new InternetAddress( email, name, this.charset ) );
  +                this.replyList.add(
  +                    new InternetAddress(email, name, this.charset));
               }
               else
               {
  -                this.replyList.add( new InternetAddress( email, name ) );
  +                this.replyList.add(new InternetAddress(email, name));
               }
           }
  -        catch ( UnsupportedEncodingException e )
  +        catch (UnsupportedEncodingException e)
           {
  -            throw new MessagingException( "cannot add replyTo", e );
  +            throw new MessagingException("cannot add replyTo", e);
           }
           return this;
       }
  @@ -700,25 +699,25 @@
        *
        * @param ht A Hashtable.
        */
  -    public void setHeaders( Hashtable ht )
  +    public void setHeaders(Hashtable ht)
       {
           Enumeration enumKeyBad = ht.keys();
  -        
  -        while ( enumKeyBad.hasMoreElements() )
  +
  +        while (enumKeyBad.hasMoreElements())
           {
               String strName = (String) enumKeyBad.nextElement();
  -            String strValue = (String) ht.get( strName );
  -            
  -            if ( !StringUtils.isNotEmpty( strName ) )
  +            String strValue = (String) ht.get(strName);
  +
  +            if (!StringUtils.isNotEmpty(strName))
               {
  -                throw new IllegalArgumentException( "name can not be null" );
  +                throw new IllegalArgumentException("name can not be null");
               }
  -            if ( !StringUtils.isNotEmpty( strValue ) )
  +            if (!StringUtils.isNotEmpty(strValue))
               {
  -                throw new IllegalArgumentException( "value can not be null" );
  +                throw new IllegalArgumentException("value can not be null");
               }
           }
  -        
  +
           // all is ok, update headers
           this.headers = ht;
       }
  @@ -729,18 +728,18 @@
        * @param name A String with the name.
        * @param value A String with the value.
        */
  -    public void addHeader( String name, String value )
  +    public void addHeader(String name, String value)
       {
  -        if ( !StringUtils.isNotEmpty( name ) )
  +        if (!StringUtils.isNotEmpty(name))
           {
  -            throw new IllegalArgumentException( "name can not be null" );
  +            throw new IllegalArgumentException("name can not be null");
           }
  -        if ( !StringUtils.isNotEmpty( value ) )
  +        if (!StringUtils.isNotEmpty(value))
           {
  -            throw new IllegalArgumentException( "value can not be null" );
  +            throw new IllegalArgumentException("value can not be null");
           }
   
  -        this.headers.put( name, value );
  +        this.headers.put(name, value);
       }
   
       /**
  @@ -749,7 +748,7 @@
        * @param aSubject A String.
        * @return An Email.
        */
  -    public Email setSubject( String aSubject )
  +    public Email setSubject(String aSubject)
       {
           this.subject = aSubject;
           return this;
  @@ -763,131 +762,136 @@
        * @return An Email.
        * @throws MessagingException generic exception
        */
  -    public abstract Email setMsg( String msg ) 
  -        throws MessagingException;
  +    public abstract Email setMsg(String msg) throws MessagingException;
   
       /**
        * Does the work of actually sending the email.
        *
        * @throws MessagingException if there was an error.
        */
  -    public void send() 
  -        throws MessagingException
  +    public void send() throws MessagingException
       {
  -        Session session = this.getMailSession();
  -        this.message = new MimeMessage( session );
  +        this.getMailSession();
  +        this.message = new MimeMessage(this.session);
   
  -        if ( StringUtils.isNotEmpty( this.subject ) )
  +        if (StringUtils.isNotEmpty(this.subject))
           {
  -            if ( StringUtils.isNotEmpty( this.charset ) )
  +            if (StringUtils.isNotEmpty(this.charset))
               {
  -                this.message.setSubject( this.subject, this.charset );
  +                this.message.setSubject(this.subject, this.charset);
               }
               else
               {
  -                this.message.setSubject( this.subject );
  +                this.message.setSubject(this.subject);
               }
           }
   
  -//
  -//      As far as i can tell, this logic is circular with the setContent( Object, String ) method.
  -//      There is no way for the content variable to be set without the contentType also being set
  -//      The logic below therefore appears to be a duplication of the setContent( Object, String ) method
  -//      or if not should it not be moved to that method? (Proposed replacement code below)
  -//      if ( this.content != null )
  -//      {
  -//          String type = this.contentType;
  -//
  -//          if ( type != null && !type.trim().equals( "" ) 
  -//              && this.charset != null && !this.charset.trim().equals( "" ) )
  -//          {
  -//              type += "; charset=" + this.charset;
  -//          }
  -//
  -//          this.message.setContent( this.content, type );
  -//      }
  +        //
  +        //      As far as i can tell, this logic is circular with 
  +        //      the setContent( Object, String ) method.
  +        //      There is no way for the content variable to be set without 
  +        //      the contentType also being set.
  +        //      The logic below therefore appears to be a duplication of 
  +        //      the setContent( Object, String ) method
  +        //      or if not should it not be moved to that method? 
  +        //      (Proposed replacement code below)
  +        //      if ( this.content != null )
  +        //      {
  +        //          String type = this.contentType;
  +        //
  +        //          if ( type != null && !type.trim().equals( "" ) 
  +        //              && this.charset != null 
  +        //              && !this.charset.trim().equals( "" ) )
  +        //          {
  +        //              type += "; charset=" + this.charset;
  +        //          }
  +        //
  +        //          this.message.setContent( this.content, type );
  +        //      }
   
           // ========================================================
           // Start of replacement code
  -        if ( this.content != null )
  +        if (this.content != null)
           {
  -            this.message.setContent( this.content, this.contentType );
  +            this.message.setContent(this.content, this.contentType);
           }
           // end of replacement code
           // ========================================================
  -        else if ( this.emailBody != null )
  +        else if (this.emailBody != null)
           {
  -            this.message.setContent( this.emailBody );
  +            this.message.setContent(this.emailBody);
           }
           else
           {
  -            this.message.setContent( "", Email.TEXT_PLAIN );
  +            this.message.setContent("", Email.TEXT_PLAIN);
           }
   
  -        if ( this.fromAddress != null )
  +        if (this.fromAddress != null)
           {
  -            this.message.setFrom( this.fromAddress );
  +            this.message.setFrom(this.fromAddress);
           }
           else
           {
  -            throw new MessagingException( "Sender address required" );
  +            throw new MessagingException("Sender address required");
           }
   
  -        if ( this.toList.size() + this.ccList.size() + this.bccList.size() == 0 )
  +        if (this.toList.size() + this.ccList.size() + this.bccList.size() == 0)
           {
  -            throw new MessagingException( "At least one receiver address required" );
  +            throw new MessagingException(
  +                        "At least one receiver address required");
           }
   
  -        if ( this.toList.size() > 0 )
  +        if (this.toList.size() > 0)
           {
  -            this.message.setRecipients( 
  -                                Message.RecipientType.TO,
  -                                this.toInternetAddressArray( this.toList ) );
  +            this.message.setRecipients(
  +                Message.RecipientType.TO,
  +                this.toInternetAddressArray(this.toList));
           }
   
  -        if ( this.ccList.size() > 0 )
  +        if (this.ccList.size() > 0)
           {
  -            this.message.setRecipients( 
  -                                Message.RecipientType.CC,
  -                                this.toInternetAddressArray( this.ccList ) );
  +            this.message.setRecipients(
  +                Message.RecipientType.CC,
  +                this.toInternetAddressArray(this.ccList));
           }
   
  -        if ( this.bccList.size() > 0 )
  +        if (this.bccList.size() > 0)
           {
  -            this.message.setRecipients( 
  -                                Message.RecipientType.BCC,
  -                                this.toInternetAddressArray( this.bccList ) );
  +            this.message.setRecipients(
  +                Message.RecipientType.BCC,
  +                this.toInternetAddressArray(this.bccList));
           }
   
  -        if ( this.replyList.size() > 0 )
  +        if (this.replyList.size() > 0)
           {
  -            this.message.setReplyTo( this.toInternetAddressArray( this.replyList ) );
  +            this.message.setReplyTo(
  +                this.toInternetAddressArray(this.replyList));
           }
   
  -        if ( this.headers.size() > 0 )
  +        if (this.headers.size() > 0)
           {
               Enumeration enum = this.headers.keys();
   
  -            while ( enum.hasMoreElements() )
  +            while (enum.hasMoreElements())
               {
                   String name = (String) enum.nextElement();
  -                String value = (String) headers.get( name );
  -                this.message.addHeader( name, value );
  +                String value = (String) headers.get(name);
  +                this.message.addHeader(name, value);
               }
           }
   
  -        if ( this.message.getSentDate() == null )
  +        if (this.message.getSentDate() == null)
           {
  -            this.message.setSentDate( getSentDate() );
  +            this.message.setSentDate(getSentDate());
           }
   
  -        if ( this.popBeforeSmtp )
  +        if (this.popBeforeSmtp)
           {
  -            Store store = session.getStore( "pop3" );
  -            store.connect( this.popHost, this.popUsername, this.popPassword );
  +            Store store = session.getStore("pop3");
  +            store.connect(this.popHost, this.popUsername, this.popPassword);
           }
   
  -        Transport.send( this.message );
  +        Transport.send(this.message);
       }
   
       /**
  @@ -896,7 +900,7 @@
        *
        * @param date Date to use as the sent date on the email
        */
  -    public void setSentDate( Date date )
  +    public void setSentDate(Date date)
       {
           this.sentDate = date;
       }
  @@ -908,7 +912,7 @@
        */
       public Date getSentDate()
       {
  -        if ( this.sentDate == null )
  +        if (this.sentDate == null)
           {
               return new Date();
           }
  @@ -925,28 +929,31 @@
        * @param aList A ArrayList.
        * @return An InternetAddress[].
        */
  -    protected InternetAddress[] toInternetAddressArray( ArrayList aList )
  +    protected InternetAddress[] toInternetAddressArray(ArrayList aList)
       {
  -        InternetAddress[] ia = (InternetAddress[]) aList.toArray( new InternetAddress[ 0 ] );
  +        InternetAddress[] ia =
  +            (InternetAddress[]) aList.toArray(new InternetAddress[0]);
   
           return ia;
       }
   
       /**
        * Set details regarding "pop3 before smtp" authentication
  -     * @param newPopBeforeSmtp Wether or not to log into pop3 server before sending mail
  +     * @param newPopBeforeSmtp Wether or not to log into pop3 
  +     *      server before sending mail
        * @param newPopHost The pop3 host to use.
        * @param newPopUsername The pop3 username.
        * @param newPopPassword The pop3 password.
        */
  -    public void setPopBeforeSmtp(   boolean newPopBeforeSmtp,
  -                                    String newPopHost,
  -                                    String newPopUsername,
  -                                    String newPopPassword )
  -    {
  -        this.popBeforeSmtp  = newPopBeforeSmtp;
  -        this.popHost        = newPopHost;
  -        this.popUsername    = newPopUsername;
  -        this.popPassword    = newPopPassword;
  +    public void setPopBeforeSmtp(
  +        boolean newPopBeforeSmtp,
  +        String newPopHost,
  +        String newPopUsername,
  +        String newPopPassword)
  +    {
  +        this.popBeforeSmtp = newPopBeforeSmtp;
  +        this.popHost = newPopHost;
  +        this.popUsername = newPopUsername;
  +        this.popPassword = newPopPassword;
       }
   }
  
  
  
  1.7       +31 -28    jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/MailMessage.java
  
  Index: MailMessage.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/MailMessage.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MailMessage.java	19 Feb 2004 22:38:06 -0000	1.6
  +++ MailMessage.java	25 Oct 2004 16:32:28 -0000	1.7
  @@ -130,7 +130,7 @@
        */
       public MailMessage()
       {
  -        this(null, null, null, null, null, "","",false);
  +        this(null, null, null, null, null, "", "", false);
       }
   
       /**
  @@ -153,32 +153,33 @@
        * <b>bcc</b>, <b>from</b>, <b>subject</b>, <b>body</b>, and
        * <b>debug</b>.
        *
  -     * @param h A String with the host.
  -     * @param t A String with the TO.
  -     * @param c A String with the CC.
  -     * @param bc A String with the BCC.
  -     * @param f A String with the FROM.
  -     * @param s A String with the SUBJECT.
  -     * @param b A String with the BODY.
  -     * @param d True if debugging is wanted.
  -     */
  -    public MailMessage(String h,
  -                       String t,
  -                       String c,
  -                       String bc,
  -                       String f,
  -                       String s,
  -                       String b,
  -                       boolean d)
  -    {
  -        host = h;
  -        to = (t == null ? null : parseAddressField(t));
  -        cc = (cc == null ? null : parseAddressField(c));
  -        bcc = (bc == null ? null : parseAddressField(bc));
  -        from = (f == null ? null : parseInternetAddress(f));
  -        subject = s;
  -        body = b;
  -        debug = d;
  +     * @param aHost A String with the host.
  +     * @param aTo A String with the TO.
  +     * @param aCc A String with the CC.
  +     * @param aBcc A String with the BCC.
  +     * @param aFrom A String with the FROM.
  +     * @param aSubject A String with the SUBJECT.
  +     * @param aBody A String with the BODY.
  +     * @param aDebug True if debugging is wanted.
  +     */
  +    public MailMessage(
  +        String aHost,
  +        String aTo,
  +        String aCc,
  +        String aBcc,
  +        String aFrom,
  +        String aSubject,
  +        String aBody,
  +        boolean aDebug)
  +    {
  +        host = aHost;
  +        to = (aTo == null ? null : parseAddressField(aTo));
  +        cc = (aCc == null ? null : parseAddressField(aCc));
  +        bcc = (aBcc == null ? null : parseAddressField(aBcc));
  +        from = (aFrom == null ? null : parseInternetAddress(aFrom));
  +        subject = aSubject;
  +        body = aBody;
  +        debug = aDebug;
       }
   
       /**
  @@ -346,7 +347,9 @@
        * @param personal A String.
        * @return An InternetAddress.
        */
  -    public static InternetAddress parseInternetAddress(String address, String personal)
  +    public static InternetAddress parseInternetAddress(
  +        String address,
  +        String personal)
       {
           InternetAddress ia = null;
           try
  
  
  
  1.4       +2 -3      jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/DefaultAuthenticator.java
  
  Index: DefaultAuthenticator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/DefaultAuthenticator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultAuthenticator.java	19 Feb 2004 22:38:07 -0000	1.3
  +++ DefaultAuthenticator.java	25 Oct 2004 16:32:28 -0000	1.4
  @@ -38,8 +38,7 @@
        */
       public DefaultAuthenticator(String userName, String password)
       {
  -        this.authentication = new PasswordAuthentication(
  -                userName, password );
  +        this.authentication = new PasswordAuthentication(userName, password);
       }
   
       /**
  
  
  
  1.10      +43 -34    jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/HtmlEmail.java
  
  Index: HtmlEmail.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/HtmlEmail.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- HtmlEmail.java	18 Oct 2004 20:59:11 -0000	1.9
  +++ HtmlEmail.java	25 Oct 2004 16:32:28 -0000	1.10
  @@ -69,27 +69,30 @@
       /** Embeded images */
       protected List inlineImages = new ArrayList();
   
  +    /** Defintion of the length of generated CID's */
  +    public static final int CID_LENGTH = 10;
  +    
       /**
        * Set the text content.
        *
  -     * @param text A String.
  +     * @param aText A String.
        * @return An HtmlEmail.
        */
  -    public HtmlEmail setTextMsg(String text)
  +    public HtmlEmail setTextMsg(String aText)
       {
  -        this.text = text;
  +        this.text = aText;
           return this;
       }
   
       /**
        * Set the HTML content.
        *
  -     * @param html A String.
  +     * @param aHtml A String.
        * @return An HtmlEmail.
        */
  -    public HtmlEmail setHtmlMsg(String html)
  +    public HtmlEmail setHtmlMsg(String aHtml)
       {
  -        this.html = html;
  +        this.html = aHtml;
           return this;
       }
   
  @@ -109,7 +112,8 @@
       {
           setTextMsg(msg);
   
  -        setHtmlMsg(new StringBuffer()
  +        setHtmlMsg(
  +            new StringBuffer()
                   .append("<html><body><pre>")
                   .append(msg)
                   .append("</pre></body></html>")
  @@ -129,7 +133,9 @@
        *
        * <p>Example of use:<br><code><pre>
        * HtmlEmail he = new HtmlEmail();
  -     * he.setHtmlMsg("&lt;html&gt;&lt;img src=cid:"+embed("file:/my/image.gif","image.gif")+"&gt;&lt;/html&gt;");
  +     * he.setHtmlMsg("&lt;html&gt;&lt;img src=cid:" +
  +     *  embed("file:/my/image.gif","image.gif") +
  +     *  "&gt;&lt;/html&gt;");
        * // code to set the others email fields (not shown)
        * </pre></code>
        *
  @@ -137,10 +143,10 @@
        * @param name The name that will be set in the filename header
        * field.
        * @return A String with the Content-ID of the file.
  -     * @exception MessagingException
  +     * @throws MessagingException when URL suplpied is invalid
  +     *  also see javax.mail.internet.MimeBodyPart for defintions
        */
  -    public String embed( URL url, String name ) 
  -        throws MessagingException
  +    public String embed(URL url, String name) throws MessagingException
       {
           // verify that the URL is valid
           try
  @@ -148,20 +154,20 @@
               InputStream is = url.openStream();
               is.close();
           }
  -        catch ( IOException e )
  +        catch (IOException e)
           {
  -            throw new MessagingException( "Invalid URL" );
  +            throw new MessagingException("Invalid URL");
           }
   
  -       MimeBodyPart mbp = new MimeBodyPart();
  +        MimeBodyPart mbp = new MimeBodyPart();
   
  -        mbp.setDataHandler ( new DataHandler( new URLDataSource( url ) ) );
  -        mbp.setFileName( name );
  -        mbp.setDisposition( "inline" );
  -        String cid = RandomStringUtils.randomAscii( 10 );
  -        mbp.addHeader( "Content-ID", cid );
  +        mbp.setDataHandler(new DataHandler(new URLDataSource(url)));
  +        mbp.setFileName(name);
  +        mbp.setDisposition("inline");
  +        String cid = RandomStringUtils.randomAscii(HtmlEmail.CID_LENGTH);
  +        mbp.addHeader("Content-ID", cid);
   
  -        this.inlineImages.add( mbp );
  +        this.inlineImages.add(mbp);
           return mbp.getContentID();
       }
   
  @@ -170,8 +176,7 @@
        *
        * @exception MessagingException if there was an error.
        */
  -    public void send() 
  -        throws MessagingException
  +    public void send() throws MessagingException
       {
           MimeMultipart container = this.getContainer();
           container.setSubType("related");
  @@ -179,26 +184,28 @@
           BodyPart msgText = null;
           BodyPart msgHtml = null;
   
  -        if ( StringUtils.isNotEmpty( this.html ) )
  +        if (StringUtils.isNotEmpty(this.html))
           {
               msgHtml = this.getPrimaryBodyPart();
  -            if ( StringUtils.isNotEmpty( this.charset ) )
  +            if (StringUtils.isNotEmpty(this.charset))
               {
  -                msgHtml.setContent( this.html, Email.TEXT_HTML + "; charset=" + this.charset );
  +                msgHtml.setContent(
  +                    this.html,
  +                    Email.TEXT_HTML + "; charset=" + this.charset);
               }
               else
               {
  -                msgHtml.setContent( this.html, Email.TEXT_HTML );
  +                msgHtml.setContent(this.html, Email.TEXT_HTML);
               }
   
               Iterator iter = this.inlineImages.iterator();
  -            while ( iter.hasNext() )
  -            { 
  -                container.addBodyPart( (BodyPart) iter.next() );
  +            while (iter.hasNext())
  +            {
  +                container.addBodyPart((BodyPart) iter.next());
               }
           }
   
  -        if ( StringUtils.isNotEmpty( this.text ) )
  +        if (StringUtils.isNotEmpty(this.text))
           {
               // if the html part of the message was null, then the text part
               // will become the primary body part
  @@ -212,13 +219,15 @@
                   container.addBodyPart(msgText);
               }
   
  -            if ( StringUtils.isNotEmpty( this.charset ) )
  +            if (StringUtils.isNotEmpty(this.charset))
               {
  -                msgText.setContent( this.text, Email.TEXT_PLAIN + "; charset=" + this.charset );
  +                msgText.setContent(
  +                    this.text,
  +                    Email.TEXT_PLAIN + "; charset=" + this.charset);
               }
               else
               {
  -                msgText.setContent( this.text, Email.TEXT_PLAIN );
  +                msgText.setContent(this.text, Email.TEXT_PLAIN);
               }
           }
   
  
  
  
  1.6       +18 -16    jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/EmailAttachment.java
  
  Index: EmailAttachment.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/EmailAttachment.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EmailAttachment.java	19 Feb 2004 22:38:09 -0000	1.5
  +++ EmailAttachment.java	25 Oct 2004 16:32:28 -0000	1.6
  @@ -25,8 +25,10 @@
    */
   public class EmailAttachment
   {
  -    public final static String ATTACHMENT = javax.mail.Part.ATTACHMENT;
  -    public final static String INLINE = javax.mail.Part.INLINE;
  +    /** Defintion of the part being an attachment */
  +    public static final String ATTACHMENT = javax.mail.Part.ATTACHMENT;
  +    /** Defintion of the part being inline */
  +    public static final String INLINE = javax.mail.Part.INLINE;
   
       /** The name of this attachment. */
       private String name = "";
  @@ -41,7 +43,7 @@
       private URL url = null;
   
       /** The disposition. */
  -    private String disposition = ATTACHMENT;
  +    private String disposition = EmailAttachment.ATTACHMENT;
   
       /**
        * Get the description.
  @@ -106,11 +108,11 @@
       /**
        * Set the name.
        *
  -     * @param name A String.
  +     * @param aName A String.
        */
  -    public void setName(String name)
  +    public void setName(String aName)
       {
  -        this.name = name;
  +        this.name = aName;
       }
   
       /**
  @@ -120,30 +122,30 @@
        * Example: /home/user/images/image.jpg<br>
        * Example: images/image.jpg
        *
  -     * @param path A String.
  +     * @param aPath A String.
        */
  -    public void setPath(String path)
  +    public void setPath(String aPath)
       {
  -        this.path = path;
  +        this.path = aPath;
       }
   
       /**
        * Set the URL.
        *
  -     * @param url A URL.
  +     * @param aUrl A URL.
        */
  -    public void setURL(URL url)
  +    public void setURL(URL aUrl)
       {
  -        this.url = url;
  +        this.url = aUrl;
       }
   
       /**
        * Set the disposition.
        *
  -     * @param disposition A String.
  +     * @param aDisposition A String.
        */
  -    public void setDisposition(String disposition)
  +    public void setDisposition(String aDisposition)
       {
  -        this.disposition = disposition;
  +        this.disposition = aDisposition;
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message