You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2014/06/30 14:26:07 UTC

svn commit: r1606709 [2/3] - in /commons/proper/email/trunk/src: main/java/org/apache/commons/mail/ main/java/org/apache/commons/mail/resolver/ main/java/org/apache/commons/mail/util/ test/java/org/apache/commons/mail/ test/java/org/apache/commons/mail...

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java?rev=1606709&r1=1606708&r2=1606709&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java Mon Jun 30 12:26:06 2014
@@ -144,11 +144,11 @@ public abstract class AbstractEmailTest
      * @throws IOException writing the email failed
      * @throws MessagingException writing the email failed
      */
-    protected void saveEmailToFile(WiserMessage email) throws IOException, MessagingException
+    protected void saveEmailToFile(final WiserMessage email) throws IOException, MessagingException
     {
-        int currCounter = fileNameCounter++ % 10;
-        String emailFileName = "email" + new Date().getTime() + "-" + currCounter + ".eml";
-        File emailFile = new File(emailOutputDir, emailFileName);
+        final int currCounter = fileNameCounter++ % 10;
+        final String emailFileName = "email" + new Date().getTime() + "-" + currCounter + ".eml";
+        final File emailFile = new File(emailOutputDir, emailFileName);
         EmailUtils.writeMimeMessage(emailFile, email.getMimeMessage() );
     }
 
@@ -156,12 +156,12 @@ public abstract class AbstractEmailTest
      * @param intMsgNo the message to retrieve
      * @return message as string
      */
-    public String getMessageAsString(int intMsgNo)
+    public String getMessageAsString(final int intMsgNo)
     {
-        List<?> receivedMessages = fakeMailServer.getMessages();
+        final List<?> receivedMessages = fakeMailServer.getMessages();
         assertTrue("mail server didn't get enough messages", receivedMessages.size() >= intMsgNo);
 
-        WiserMessage emailMessage = (WiserMessage) receivedMessages.get(intMsgNo);
+        final WiserMessage emailMessage = (WiserMessage) receivedMessages.get(intMsgNo);
 
         if (emailMessage != null)
         {
@@ -169,7 +169,7 @@ public abstract class AbstractEmailTest
             {
                 return serializeEmailMessage(emailMessage);
             }
-            catch (Exception e)
+            catch (final Exception e)
             {
                 // ignore, since the test will fail on an empty string return
             }
@@ -195,7 +195,7 @@ public abstract class AbstractEmailTest
 
             assertFalse("fake mail server didn't start", isMailServerStopped(fakeMailServer));
 
-            Date dtStartWait = new Date();
+            final Date dtStartWait = new Date();
             while (isMailServerStopped(fakeMailServer))
             {
                 // test for connected
@@ -228,18 +228,18 @@ public abstract class AbstractEmailTest
      * @throws IOException Exception
      */
     protected WiserMessage validateSend(
-        Wiser mailServer,
-        String strSubject,
-        InternetAddress fromAdd,
-        List<InternetAddress> toAdd,
-        List<InternetAddress> ccAdd,
-        List<InternetAddress> bccAdd,
-        boolean boolSaveToFile)
+        final Wiser mailServer,
+        final String strSubject,
+        final InternetAddress fromAdd,
+        final List<InternetAddress> toAdd,
+        final List<InternetAddress> ccAdd,
+        final List<InternetAddress> bccAdd,
+        final boolean boolSaveToFile)
         throws IOException
     {
         assertTrue("mail server doesn't contain expected message",
                 mailServer.getMessages().size() == 1);
-        WiserMessage emailMessage = mailServer.getMessages().get(0);
+        final WiserMessage emailMessage = mailServer.getMessages().get(0);
 
         if (boolSaveToFile)
         {
@@ -247,9 +247,9 @@ public abstract class AbstractEmailTest
             {
                 this.saveEmailToFile(emailMessage);
             }
-            catch(MessagingException me)
+            catch(final MessagingException me)
             {
-                IllegalStateException ise =
+                final IllegalStateException ise =
                     new IllegalStateException("caught MessagingException during saving the email");
                 ise.initCause(me);
                 throw ise;
@@ -259,7 +259,7 @@ public abstract class AbstractEmailTest
         try
         {
             // get the MimeMessage
-            MimeMessage mimeMessage = emailMessage.getMimeMessage();
+            final MimeMessage mimeMessage = emailMessage.getMimeMessage();
 
             // test subject
             assertEquals("got wrong subject from mail",
@@ -287,9 +287,9 @@ public abstract class AbstractEmailTest
                     bccAdd.toString().contains(mimeMessage.getHeader("Bcc", null)));
             }
         }
-        catch (MessagingException me)
+        catch (final MessagingException me)
         {
-            IllegalStateException ise =
+            final IllegalStateException ise =
                 new IllegalStateException("caught MessagingException in validateSend()");
             ise.initCause(me);
             throw ise;
@@ -311,18 +311,18 @@ public abstract class AbstractEmailTest
      * @throws IOException Exception
      */
     protected void validateSend(
-        Wiser mailServer,
-        String strSubject,
-        Multipart content,
-        InternetAddress fromAdd,
-        List<InternetAddress> toAdd,
-        List<InternetAddress> ccAdd,
-        List<InternetAddress> bccAdd,
-        boolean boolSaveToFile)
+        final Wiser mailServer,
+        final String strSubject,
+        final Multipart content,
+        final InternetAddress fromAdd,
+        final List<InternetAddress> toAdd,
+        final List<InternetAddress> ccAdd,
+        final List<InternetAddress> bccAdd,
+        final boolean boolSaveToFile)
         throws IOException
     {
         // test other properties
-        WiserMessage emailMessage = this.validateSend(
+        final WiserMessage emailMessage = this.validateSend(
             mailServer,
             strSubject,
             fromAdd,
@@ -334,12 +334,12 @@ public abstract class AbstractEmailTest
         // test message content
 
         // get sent email content
-        String strSentContent =
+        final String strSentContent =
             content.getContentType();
         // get received email content (chop off the auto-added \n
         // and -- (front and end)
-        String emailMessageBody = getMessageBody(emailMessage);
-        String strMessageBody =
+        final String emailMessageBody = getMessageBody(emailMessage);
+        final String strMessageBody =
             emailMessageBody.substring(AbstractEmailTest.BODY_START_PAD,
                                        emailMessageBody.length()
                                        - AbstractEmailTest.BODY_END_PAD);
@@ -360,18 +360,18 @@ public abstract class AbstractEmailTest
      * @throws IOException Exception
      */
     protected void validateSend(
-        Wiser mailServer,
-        String strSubject,
-        String strMessage,
-        InternetAddress fromAdd,
-        List<InternetAddress> toAdd,
-        List<InternetAddress> ccAdd,
-        List<InternetAddress> bccAdd,
-        boolean boolSaveToFile)
+        final Wiser mailServer,
+        final String strSubject,
+        final String strMessage,
+        final InternetAddress fromAdd,
+        final List<InternetAddress> toAdd,
+        final List<InternetAddress> ccAdd,
+        final List<InternetAddress> bccAdd,
+        final boolean boolSaveToFile)
         throws IOException
     {
         // test other properties
-        WiserMessage emailMessage = this.validateSend(
+        final WiserMessage emailMessage = this.validateSend(
             mailServer,
             strSubject,
             fromAdd,
@@ -401,7 +401,7 @@ public abstract class AbstractEmailTest
      *             {@link MimeMessage#getDataHandler()}
      * @since 1.1
      */
-    private String serializeEmailMessage(WiserMessage wiserMessage)
+    private String serializeEmailMessage(final WiserMessage wiserMessage)
             throws MessagingException, IOException
     {
         if (wiserMessage == null)
@@ -409,14 +409,14 @@ public abstract class AbstractEmailTest
             return "";
         }
 
-        StringBuffer serializedEmail = new StringBuffer();
-        MimeMessage message = wiserMessage.getMimeMessage();
+        final StringBuffer serializedEmail = new StringBuffer();
+        final MimeMessage message = wiserMessage.getMimeMessage();
 
         // Serialize the headers
-        for (Enumeration<?> headers = message.getAllHeaders(); headers
+        for (final Enumeration<?> headers = message.getAllHeaders(); headers
                 .hasMoreElements();)
         {
-            Header header = (Header) headers.nextElement();
+            final Header header = (Header) headers.nextElement();
             serializedEmail.append(header.getName());
             serializedEmail.append(": ");
             serializedEmail.append(header.getValue());
@@ -424,7 +424,7 @@ public abstract class AbstractEmailTest
         }
 
         // Serialize the body
-        byte[] messageBody = getMessageBodyBytes(message);
+        final byte[] messageBody = getMessageBodyBytes(message);
 
         serializedEmail.append(LINE_SEPARATOR);
         serializedEmail.append(messageBody);
@@ -444,7 +444,7 @@ public abstract class AbstractEmailTest
      *             {@link DataHandler#writeTo(java.io.OutputStream)}.
      * @since 1.1
      */
-    private String getMessageBody(WiserMessage wiserMessage)
+    private String getMessageBody(final WiserMessage wiserMessage)
             throws IOException
     {
         if (wiserMessage == null)
@@ -456,14 +456,14 @@ public abstract class AbstractEmailTest
 
         try
         {
-            MimeMessage message = wiserMessage.getMimeMessage();
+            final MimeMessage message = wiserMessage.getMimeMessage();
             messageBody = getMessageBodyBytes(message);
         }
-        catch (MessagingException me)
+        catch (final MessagingException me)
         {
             // Thrown while getting the body content from
             // {@link MimeMessage#getDataHandler()}
-            IllegalStateException ise =
+            final IllegalStateException ise =
                 new IllegalStateException("couldn't process MimeMessage from WiserMessage in getMessageBody()");
             ise.initCause(me);
             throw ise;
@@ -486,12 +486,12 @@ public abstract class AbstractEmailTest
      *             {@link MimeMessage#getDataHandler()}
      * @since 1.1
      */
-    private byte[] getMessageBodyBytes(MimeMessage mimeMessage)
+    private byte[] getMessageBodyBytes(final MimeMessage mimeMessage)
             throws IOException, MessagingException
     {
-        DataHandler dataHandler = mimeMessage.getDataHandler();
-        ByteArrayOutputStream byteArrayOutStream = new ByteArrayOutputStream();
-        BufferedOutputStream buffOs = new BufferedOutputStream(
+        final DataHandler dataHandler = mimeMessage.getDataHandler();
+        final ByteArrayOutputStream byteArrayOutStream = new ByteArrayOutputStream();
+        final BufferedOutputStream buffOs = new BufferedOutputStream(
                 byteArrayOutStream);
         dataHandler.writeTo(buffOs);
         buffOs.flush();
@@ -508,7 +508,7 @@ public abstract class AbstractEmailTest
      * @return <code>true</code> if the server claims to be running
      * @since 1.1
      */
-    protected boolean isMailServerStopped(Wiser fakeMailServer) {
+    protected boolean isMailServerStopped(final Wiser fakeMailServer) {
         return !fakeMailServer.getServer().isRunning();
     }
     
@@ -522,7 +522,7 @@ public abstract class AbstractEmailTest
      * @return an invalid URL
      */
     protected URL createInvalidURL() throws Exception {
-        URL url = createMock(URL.class);
+        final URL url = createMock(URL.class);
         expect(url.openStream()).andThrow(new IOException());
         replay(url);
         

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/DefaultAuthenticatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/DefaultAuthenticatorTest.java?rev=1606709&r1=1606708&r2=1606709&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/DefaultAuthenticatorTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/DefaultAuthenticatorTest.java Mon Jun 30 12:26:06 2014
@@ -34,9 +34,9 @@ public class DefaultAuthenticatorTest
     public void testDefaultAuthenticatorConstructor()
     {
         //insert code testing basic functionality
-        String strUsername = "user.name";
-        String strPassword = "user.pwd";
-        DefaultAuthenticator authenticator = new DefaultAuthenticator(strUsername, strPassword);
+        final String strUsername = "user.name";
+        final String strPassword = "user.pwd";
+        final DefaultAuthenticator authenticator = new DefaultAuthenticator(strUsername, strPassword);
 
         assertTrue(
             PasswordAuthentication.class.isInstance(

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailAttachmentTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailAttachmentTest.java?rev=1606709&r1=1606708&r2=1606709&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailAttachmentTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailAttachmentTest.java Mon Jun 30 12:26:06 2014
@@ -42,7 +42,7 @@ public class EmailAttachmentTest extends
     @Test
     public void testGetSetDescription()
     {
-        for (String validChar : testCharsValid)
+        for (final String validChar : testCharsValid)
         {
             attachment.setDescription(validChar);
             assertEquals(validChar, attachment.getDescription());
@@ -52,7 +52,7 @@ public class EmailAttachmentTest extends
     @Test
     public void testGetSetName()
     {
-        for (String validChar : testCharsValid)
+        for (final String validChar : testCharsValid)
         {
             attachment.setName(validChar);
             assertEquals(validChar, attachment.getName());
@@ -62,7 +62,7 @@ public class EmailAttachmentTest extends
     @Test
     public void testGetSetPath()
     {
-        for (String validChar : testCharsValid)
+        for (final String validChar : testCharsValid)
         {
             attachment.setPath(validChar);
             assertEquals(validChar, attachment.getPath());
@@ -72,15 +72,15 @@ public class EmailAttachmentTest extends
     @Test
     public void testGetSetURL() throws Exception
     {
-        String[] tests =
+        final String[] tests =
             {
                 "http://localhost/",
                 "http://www.apache.org/",
                 "http://foo.notexisting.org" };
 
-        for (String urlString : tests)
+        for (final String urlString : tests)
         {
-            URL testURL = new URL(urlString);
+            final URL testURL = new URL(urlString);
             attachment.setURL(testURL);
             assertEquals(testURL, attachment.getURL());
         }
@@ -89,7 +89,7 @@ public class EmailAttachmentTest extends
     @Test
     public void testGetSetDisposition()
     {
-        for (String validChar : testCharsValid)
+        for (final String validChar : testCharsValid)
         {
             attachment.setDisposition(validChar);
             assertEquals(validChar, attachment.getDisposition());

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailLiveTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailLiveTest.java?rev=1606709&r1=1606708&r2=1606709&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailLiveTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailLiveTest.java Mon Jun 30 12:26:06 2014
@@ -55,7 +55,7 @@ public class EmailLiveTest extends Abstr
         System.setProperty("mail.mime.encodefilename", "true");
     }
 
-    protected Email send(Email email) throws EmailException {
+    protected Email send(final Email email) throws EmailException {
 
         if( EmailConfiguration.MAIL_FORCE_SEND ) {
             email.send();
@@ -67,10 +67,10 @@ public class EmailLiveTest extends Abstr
         return email;
     }
 
-    protected String getFromUrl(URL url) throws Exception {
+    protected String getFromUrl(final URL url) throws Exception {
 
-        URLDataSource dataSource = new URLDataSource(url);
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final URLDataSource dataSource = new URLDataSource(url);
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
         IOUtils.copy(dataSource.getInputStream(), baos);
         return new String(baos.toByteArray(), "UTF-8");
     }
@@ -82,9 +82,9 @@ public class EmailLiveTest extends Abstr
      * @return the new instance
      * @throws Exception creating the Email instance failed
      */
-    private Email create(Class<? extends Email> clazz) throws Exception {
+    private Email create(final Class<? extends Email> clazz) throws Exception {
 
-        Email email = clazz.newInstance();
+        final Email email = clazz.newInstance();
 
         email.setStartTLSEnabled(EmailConfiguration.MAIL_USE_STARTTLS);
         email.setStartTLSRequired(EmailConfiguration.MAIL_STARTTLS_REQUIRED);
@@ -117,7 +117,7 @@ public class EmailLiveTest extends Abstr
     @Test
     public void testSimpleEmail() throws Exception
     {
-        SimpleEmail email = (SimpleEmail) create(SimpleEmail.class);
+        final SimpleEmail email = (SimpleEmail) create(SimpleEmail.class);
         email.setSubject("TestSimpleMail");
         email.setMsg("This is a test mail ... :-)");
 
@@ -132,7 +132,7 @@ public class EmailLiveTest extends Abstr
     @Test
     public void testFoldedHeaderValue() throws Exception
     {
-        SimpleEmail email = (SimpleEmail) create(SimpleEmail.class);
+        final SimpleEmail email = (SimpleEmail) create(SimpleEmail.class);
         email.setSubject("TestFoldedHeaderMail");
         email.setMsg("This is a test mail with a folded header value... :-)");
         email.addHeader("X-TestHeader", "This is a very long header value which should be folded into two lines, hopefully");
@@ -148,7 +148,7 @@ public class EmailLiveTest extends Abstr
     @Test
     public void testMultiPartEmail() throws Exception
     {
-        MultiPartEmail email = (MultiPartEmail) create(MultiPartEmail.class);
+        final MultiPartEmail email = (MultiPartEmail) create(MultiPartEmail.class);
         email.setSubject("TestMultiPartMail");
         email.setMsg("This is a test mail ... :-)");
         email.attach(new File("./src/test/resources/attachments/logo.pdf"));
@@ -173,18 +173,18 @@ public class EmailLiveTest extends Abstr
 
         String cid;
 
-        URL url = new URL(EmailConfiguration.TEST_URL);
-        File imageFile = new File("./src/test/resources/images/asf_logo_wide.gif");
+        final URL url = new URL(EmailConfiguration.TEST_URL);
+        final File imageFile = new File("./src/test/resources/images/asf_logo_wide.gif");
 
-        EmailAttachment attachment = new EmailAttachment();
-        File attachmentFile = new File("./src/test/resources/attachments/logo.pdf");
+        final EmailAttachment attachment = new EmailAttachment();
+        final File attachmentFile = new File("./src/test/resources/attachments/logo.pdf");
         attachment.setName("logo.pdf");
         attachment.setDescription("The official Apache logo");
         attachment.setPath(attachmentFile.getAbsolutePath());
 
         // 1) text + html content
 
-        HtmlEmail htmlEmail1 = (HtmlEmail) create(HtmlEmail.class);
+        final HtmlEmail htmlEmail1 = (HtmlEmail) create(HtmlEmail.class);
         textMsg = "Your email client does not support HTML messages";
         htmlMsg = "<html><b>This is a HTML message without any image</b><html>";
 
@@ -196,7 +196,7 @@ public class EmailLiveTest extends Abstr
 
         // 2) text + html content + image as attachment
 
-        HtmlEmail htmlEmail2 = (HtmlEmail) create(HtmlEmail.class);
+        final HtmlEmail htmlEmail2 = (HtmlEmail) create(HtmlEmail.class);
         textMsg = "Your email client does not support HTML messages";
         htmlMsg = "<html><b>This is a HTML message with an image attachment</b><html>";
 
@@ -209,7 +209,7 @@ public class EmailLiveTest extends Abstr
 
         // 3) text + html content + inline image
 
-        HtmlEmail htmlEmail3 = (HtmlEmail) create(HtmlEmail.class);
+        final HtmlEmail htmlEmail3 = (HtmlEmail) create(HtmlEmail.class);
         textMsg = "Your email client does not support HTML messages";
         cid = htmlEmail3.embed(imageFile, "Apache Logo");
 
@@ -224,7 +224,7 @@ public class EmailLiveTest extends Abstr
 
         // 4) text + html content + inline image + attachment
 
-        HtmlEmail htmlEmail4 = (HtmlEmail) create(HtmlEmail.class);
+        final HtmlEmail htmlEmail4 = (HtmlEmail) create(HtmlEmail.class);
         textMsg = "Your email client does not support HTML messages";
         cid = htmlEmail4.embed(imageFile, "Apache Logo");
         htmlMsg = "<html><b>This is a HTML message with an inline image - <img src=\"cid:" + cid + "\"> and attachment</b><html>";
@@ -257,12 +257,12 @@ public class EmailLiveTest extends Abstr
         final String attachmentName = "\u03B1\u03B2\u03B3.txt";
 
         // make sure to set the charset before adding the message content
-        MultiPartEmail email = (MultiPartEmail) create(MultiPartEmail.class);
+        final MultiPartEmail email = (MultiPartEmail) create(MultiPartEmail.class);
         email.setSubject(subject);
         email.setMsg(textMsg);
 
         // create a proper UTF-8 sequence for the text attachment (matching our default charset)
-        DataSource attachment = new javax.mail.util.ByteArrayDataSource(textMsg.getBytes("utf-8"), "text/plain");
+        final DataSource attachment = new javax.mail.util.ByteArrayDataSource(textMsg.getBytes("utf-8"), "text/plain");
         email.attach(attachment, attachmentName, "Attachment in Greek");
         
         EmailUtils.writeMimeMessage( new File("./target/test-emails/correct-encoding.eml"), send(email).getMimeMessage());
@@ -278,10 +278,10 @@ public class EmailLiveTest extends Abstr
     {
         // use a simple HTML page with one image 
 
-        File htmlFile = new File("./src/test/resources/html/www.apache.org.html");
-        String htmlMsg1 = FileUtils.readFileToString(htmlFile);
+        final File htmlFile = new File("./src/test/resources/html/www.apache.org.html");
+        final String htmlMsg1 = FileUtils.readFileToString(htmlFile);
 
-        ImageHtmlEmail email = (ImageHtmlEmail) create(ImageHtmlEmail.class);
+        final ImageHtmlEmail email = (ImageHtmlEmail) create(ImageHtmlEmail.class);
         email.setDataSourceResolver(new DataSourceUrlResolver(htmlFile.getParentFile().toURI().toURL(), false));
         email.setSubject("[testImageHtmlEmail] 1.Test: simple html content");
         email.setHtmlMsg(htmlMsg1);
@@ -302,11 +302,11 @@ public class EmailLiveTest extends Abstr
     {
         if(EmailConfiguration.MAIL_FORCE_SEND)
         {
-            URL url = new URL("http://commons.apache.org/email/");
+            final URL url = new URL("http://commons.apache.org/email/");
             // URL url = new URL("http://www.dzone.com/links/index.html");
-            String htmlMsg = getFromUrl(url);
+            final String htmlMsg = getFromUrl(url);
 
-            ImageHtmlEmail email = (ImageHtmlEmail) create(ImageHtmlEmail.class);
+            final ImageHtmlEmail email = (ImageHtmlEmail) create(ImageHtmlEmail.class);
             email.setDataSourceResolver(new DataSourceUrlResolver(url, true));
             email.setSubject("[testImageHtmlEmail] 2.Test: complex html content");
             email.setHtmlMsg(htmlMsg);
@@ -328,16 +328,16 @@ public class EmailLiveTest extends Abstr
     @Test    
     public void testSendingEmailsInBatch() throws Exception
     {
-        List<SimpleEmail> emails = new ArrayList<SimpleEmail>();
+        final List<SimpleEmail> emails = new ArrayList<SimpleEmail>();
 
         // we need to instantiate an email to provide the mail session - a bit ugly
-        Session session = create(SimpleEmail.class).getMailSession();
-        Transport transport = session.getTransport();
+        final Session session = create(SimpleEmail.class).getMailSession();
+        final Transport transport = session.getTransport();
 
         // simulate creating a bunch of emails using an existing mail session
         for(int i=0; i<3; i++)
         {
-            SimpleEmail personalizedEmail = (SimpleEmail) create(SimpleEmail.class);
+            final SimpleEmail personalizedEmail = (SimpleEmail) create(SimpleEmail.class);
             personalizedEmail.setMailSession(session);
             personalizedEmail.setSubject("Personalized Test Mail Nr. " + i);
             personalizedEmail.setMsg("This is a personalized test mail ... :-)");
@@ -350,9 +350,9 @@ public class EmailLiveTest extends Abstr
         {
             transport.connect();
 
-            for (SimpleEmail personalizedEmail : emails)
+            for (final SimpleEmail personalizedEmail : emails)
             {
-                MimeMessage mimeMessage = personalizedEmail.getMimeMessage();
+                final MimeMessage mimeMessage = personalizedEmail.getMimeMessage();
                 Transport.send(mimeMessage);
                 System.out.println("Successfully sent the following email : " + mimeMessage.getMessageID());
             }
@@ -371,7 +371,7 @@ public class EmailLiveTest extends Abstr
     @Test
     public void testPartialSend() throws Exception
     {
-        SimpleEmail email = (SimpleEmail) create(SimpleEmail.class);
+        final SimpleEmail email = (SimpleEmail) create(SimpleEmail.class);
         email.addTo(EmailConfiguration.TEST_TO);
         email.addTo("asdkljfakld@kadjfka.com");
         email.setSubject("TestPartialMail");

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java?rev=1606709&r1=1606708&r2=1606709&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java Mon Jun 30 12:26:06 2014
@@ -82,7 +82,7 @@ public class EmailTest extends AbstractE
     public void testGetSetSession() throws Exception
     {
 
-        Properties properties = new Properties(System.getProperties());
+        final Properties properties = new Properties(System.getProperties());
         properties.setProperty(EmailConstants.MAIL_TRANSPORT_PROTOCOL, EmailConstants.SMTP);
 
         properties.setProperty(
@@ -91,7 +91,7 @@ public class EmailTest extends AbstractE
         properties.setProperty(EmailConstants.MAIL_HOST, strTestMailServer);
         properties.setProperty(EmailConstants.MAIL_DEBUG, String.valueOf(false));
 
-        Session mySession = Session.getInstance(properties, null);
+        final Session mySession = Session.getInstance(properties, null);
 
         email.setMailSession(mySession);
         assertEquals(mySession, email.getMailSession());
@@ -102,13 +102,13 @@ public class EmailTest extends AbstractE
     public void testGetSetAuthentication()
     {
         // setup
-        String strUsername = "user.name";
-        String strPassword = "user.pwd";
+        final String strUsername = "user.name";
+        final String strPassword = "user.pwd";
         email.setAuthentication(strUsername, strPassword);
 
         // this is cast into DefaultAuthenticator for convenience
         // and give us access to the getPasswordAuthentication fn
-        DefaultAuthenticator retrievedAuth =
+        final DefaultAuthenticator retrievedAuth =
             (DefaultAuthenticator) email.getAuthenticator();
 
         // tests
@@ -124,15 +124,15 @@ public class EmailTest extends AbstractE
     public void testGetSetAuthenticator()
     {
         // setup
-        String strUsername = "user.name";
-        String strPassword = "user.pwd";
-        DefaultAuthenticator authenticator =
+        final String strUsername = "user.name";
+        final String strPassword = "user.pwd";
+        final DefaultAuthenticator authenticator =
             new DefaultAuthenticator(strUsername, strPassword);
         email.setAuthenticator(authenticator);
 
         // this is cast into DefaultAuthenticator for convenience
         // and give us access to the getPasswordAuthentication fn
-        DefaultAuthenticator retrievedAuth =
+        final DefaultAuthenticator retrievedAuth =
             (DefaultAuthenticator) email.getAuthenticator();
 
         // tests
@@ -161,7 +161,7 @@ public class EmailTest extends AbstractE
     @Test
     public void testSetContentEmptyMimeMultipart()
     {
-        MimeMultipart part = new MimeMultipart();
+        final MimeMultipart part = new MimeMultipart();
         email.setContent(part);
 
         assertEquals(part, email.getContentMimeMultipart());
@@ -170,7 +170,7 @@ public class EmailTest extends AbstractE
     @Test
     public void testSetContentMimeMultipart()
     {
-        MimeMultipart part = new MimeMultipart("abc123");
+        final MimeMultipart part = new MimeMultipart("abc123");
         email.setContent(part);
 
         assertEquals(part, email.getContentMimeMultipart());
@@ -226,7 +226,7 @@ public class EmailTest extends AbstractE
     @Test
     public void testGetSetHostName()
     {
-        for (String validChar : testCharsValid) {
+        for (final String validChar : testCharsValid) {
             email.setHostName(validChar);
             assertEquals(validChar, email.getHostName());
         }
@@ -271,7 +271,7 @@ public class EmailTest extends AbstractE
         // Test Success
         // ====================================================================
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com", "me@home.com"));
         arrExpected.add(
             new InternetAddress(
@@ -299,9 +299,9 @@ public class EmailTest extends AbstractE
         // ====================================================================
         // Test Success (with charset set)
         // ====================================================================
-        String testValidEmail = "me@home.com";
+        final String testValidEmail = "me@home.com";
 
-        InternetAddress inetExpected =
+        final InternetAddress inetExpected =
             new InternetAddress("me@home.com", "me@home.com", EmailConstants.ISO_8859_1);
 
         // set from
@@ -318,8 +318,8 @@ public class EmailTest extends AbstractE
         // ====================================================================
         // Test Success
         // ====================================================================
-        String[] testEmailNames = {"Name1", "", null};
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final String[] testEmailNames = {"Name1", "", null};
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com", "Name1"));
         arrExpected.add(
             new InternetAddress(
@@ -353,12 +353,12 @@ public class EmailTest extends AbstractE
         // Test Success
         // ====================================================================
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com"));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
         arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
 
-        for (String address : VALID_EMAILS) {
+        for (final String address : VALID_EMAILS) {
             email.addTo(address);
         }
 
@@ -374,7 +374,7 @@ public class EmailTest extends AbstractE
         // Test Success
         // ====================================================================
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com"));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
         arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -393,10 +393,10 @@ public class EmailTest extends AbstractE
         // ====================================================================
         // Test Success
         // ====================================================================
-        String testCharset = EmailConstants.ISO_8859_1;
-        String[] testEmailNames = {"Name1", "", null};
+        final String testCharset = EmailConstants.ISO_8859_1;
+        final String[] testEmailNames = {"Name1", "", null};
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(
             new InternetAddress(
                 "me@home.com",
@@ -423,9 +423,9 @@ public class EmailTest extends AbstractE
         // Test Success
         // ====================================================================
 
-        String[] testEmailNames = {"Name1", "", null};
+        final String[] testEmailNames = {"Name1", "", null};
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com", "Name1"));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
         arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -453,7 +453,7 @@ public class EmailTest extends AbstractE
         // ====================================================================
         // Test Success
         // ====================================================================
-        List<InternetAddress> testEmailValid2 = new ArrayList<InternetAddress>();
+        final List<InternetAddress> testEmailValid2 = new ArrayList<InternetAddress>();
         testEmailValid2.add(new InternetAddress("me@home.com", "Name1"));
         testEmailValid2.add(
             new InternetAddress(
@@ -492,12 +492,12 @@ public class EmailTest extends AbstractE
         // Test Success
         // ====================================================================
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com"));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
         arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
 
-        for (String address : VALID_EMAILS) {
+        for (final String address : VALID_EMAILS) {
             email.addCc(address);
         }
 
@@ -513,7 +513,7 @@ public class EmailTest extends AbstractE
         // Test Success
         // ====================================================================
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com"));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
         arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -532,10 +532,10 @@ public class EmailTest extends AbstractE
         // ====================================================================
         // Test Success
         // ====================================================================
-        String testCharset = EmailConstants.ISO_8859_1;
-        String[] testEmailNames = {"Name1", "", null};
+        final String testCharset = EmailConstants.ISO_8859_1;
+        final String[] testEmailNames = {"Name1", "", null};
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(
             new InternetAddress("me@home.com", "Name1", testCharset));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
@@ -559,9 +559,9 @@ public class EmailTest extends AbstractE
         // Test Success
         // ====================================================================
 
-        String[] testEmailNames = {"Name1", "", null};
+        final String[] testEmailNames = {"Name1", "", null};
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com", "Name1"));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
         arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -589,7 +589,7 @@ public class EmailTest extends AbstractE
         // ====================================================================
         // Test Success
         // ====================================================================
-        List<InternetAddress> testEmailValid2 = new ArrayList<InternetAddress>();
+        final List<InternetAddress> testEmailValid2 = new ArrayList<InternetAddress>();
         testEmailValid2.add(new InternetAddress("Name1 <me...@home.com>"));
         testEmailValid2.add(new InternetAddress("\"joe.doe@apache.org\" <jo...@apache.org>"));
         testEmailValid2.add(
@@ -618,12 +618,12 @@ public class EmailTest extends AbstractE
         // Test Success
         // ====================================================================
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com"));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
         arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
 
-        for (String address : VALID_EMAILS) {
+        for (final String address : VALID_EMAILS) {
             email.addBcc(address);
         }
 
@@ -641,7 +641,7 @@ public class EmailTest extends AbstractE
         // Test Success
         // ====================================================================
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com"));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
         arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -662,10 +662,10 @@ public class EmailTest extends AbstractE
         // ====================================================================
         // Test Success
         // ====================================================================
-        String testCharset = EmailConstants.ISO_8859_1;
-        String[] testEmailNames = {"Name1", "", null};
+        final String testCharset = EmailConstants.ISO_8859_1;
+        final String[] testEmailNames = {"Name1", "", null};
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com", "Name1", testCharset));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
         arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -690,10 +690,10 @@ public class EmailTest extends AbstractE
         // Test Success
         // ====================================================================
 
-        String[] testEmailNames = {"Name1", "", null};
+        final String[] testEmailNames = {"Name1", "", null};
 
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com", "Name1"));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
         arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -723,7 +723,7 @@ public class EmailTest extends AbstractE
         // ====================================================================
         // Test Success
         // ====================================================================
-        List<InternetAddress> testInetEmailValid = new ArrayList<InternetAddress>();
+        final List<InternetAddress> testInetEmailValid = new ArrayList<InternetAddress>();
         testInetEmailValid.add(new InternetAddress("me@home.com", "Name1"));
         testInetEmailValid.add(
             new InternetAddress(
@@ -757,12 +757,12 @@ public class EmailTest extends AbstractE
         // Test Success
         // ====================================================================
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com"));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
         arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
 
-        for (String address : VALID_EMAILS) {
+        for (final String address : VALID_EMAILS) {
             email.addReplyTo(address);
         }
 
@@ -779,10 +779,10 @@ public class EmailTest extends AbstractE
         // ====================================================================
         // Test Success
         // ====================================================================
-        String testCharset = EmailConstants.ISO_8859_1;
-        String[] testEmailNames = {"Name1", "", null};
+        final String testCharset = EmailConstants.ISO_8859_1;
+        final String[] testEmailNames = {"Name1", "", null};
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com", "Name1", testCharset));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
         arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -807,9 +807,9 @@ public class EmailTest extends AbstractE
         // Test Success
         // ====================================================================
 
-        String[] testEmailNames = {"Name1", "", null};
+        final String[] testEmailNames = {"Name1", "", null};
 
-        List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
+        final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
         arrExpected.add(new InternetAddress("me@home.com", "Name1"));
         arrExpected.add(new InternetAddress("joe.doe@apache.org"));
         arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -839,14 +839,14 @@ public class EmailTest extends AbstractE
         // ====================================================================
         // Test Success
         // ====================================================================
-        Map<String, String> headers = new HashMap<String, String>();
+        final Map<String, String> headers = new HashMap<String, String>();
         headers.put("X-Priority", "1");
         headers.put("Disposition-Notification-To", "me@home.com");
         headers.put("X-Mailer", "Sendmail");
 
-        for (Map.Entry<String, String> header : headers.entrySet()) {
-            String name = header.getKey();
-            String value = header.getValue();
+        for (final Map.Entry<String, String> header : headers.entrySet()) {
+            final String name = header.getKey();
+            final String value = header.getValue();
             email.addHeader(name, value);
         }
 
@@ -881,7 +881,7 @@ public class EmailTest extends AbstractE
     @Test
     public void testSetHeaders()
     {
-        Map<String, String> ht = new Hashtable<String, String>();
+        final Map<String, String> ht = new Hashtable<String, String>();
         ht.put("X-Priority", "1");
         ht.put("Disposition-Notification-To", "me@home.com");
         ht.put("X-Mailer", "Sendmail");
@@ -910,14 +910,14 @@ public class EmailTest extends AbstractE
         
         email.buildMimeMessage();
 
-        MimeMessage msg = email.getMimeMessage();
+        final MimeMessage msg = email.getMimeMessage();
         msg.saveChanges();
         
-        String[] values = msg.getHeader("X-LongHeader");
+        final String[] values = msg.getHeader("X-LongHeader");
         assertEquals(1, values.length);
         
         // the header should be split in two lines
-        String[] lines = values[0].split("\\r\\n");
+        final String[] lines = values[0].split("\\r\\n");
         assertEquals(2, lines.length);
         
         // there should only be one line-break
@@ -951,7 +951,7 @@ public class EmailTest extends AbstractE
     @Test
     public void testSetSubject()
     {
-        for (String validChar : testCharsValid) {
+        for (final String validChar : testCharsValid) {
             email.setSubject(validChar);
             assertEquals(validChar, email.getSubject());
         }
@@ -989,7 +989,7 @@ public class EmailTest extends AbstractE
             email.send();
             fail("Should have thrown an exception");
         }
-        catch (EmailException e)
+        catch (final EmailException e)
         {
             assertTrue(e.getCause() instanceof ParseException);
             fakeMailServer.stop();
@@ -1052,7 +1052,7 @@ public class EmailTest extends AbstractE
             email.send();
             fail("Should have thrown an exception");
         }
-        catch (EmailException e)
+        catch (final EmailException e)
         {
             assertTrue(e.getMessage().contains("bad.host.com:465"));
             fakeMailServer.stop();
@@ -1064,14 +1064,14 @@ public class EmailTest extends AbstractE
     {
         // with input date
 
-        Date dtTest = Calendar.getInstance().getTime();
+        final Date dtTest = Calendar.getInstance().getTime();
         email.setSentDate(dtTest);
         assertEquals(dtTest, email.getSentDate());
 
         // with null input (this is a fudge :D)
         email.setSentDate(null);
 
-        Date sentDate = email.getSentDate();
+        final Date sentDate = email.getSentDate();
 
         // Date objects are millisecond specific. If you have a slow processor,
         // time passes between the generation of dtTest and the new Date() in
@@ -1083,7 +1083,7 @@ public class EmailTest extends AbstractE
     @Test
     public void testToInternetAddressArray() throws Exception
     {
-        List<InternetAddress> testInetEmailValid = new ArrayList<InternetAddress>();
+        final List<InternetAddress> testInetEmailValid = new ArrayList<InternetAddress>();
 
         testInetEmailValid.add(new InternetAddress("me@home.com", "Name1"));
         testInetEmailValid.add(
@@ -1105,10 +1105,10 @@ public class EmailTest extends AbstractE
     public void testSetPopBeforeSmtp()
     {
         // simple test (can be improved)
-        boolean boolPopBeforeSmtp = true;
-        String strHost = "mail.home.com";
-        String strUsername = "user.name";
-        String strPassword = "user.passwd";
+        final boolean boolPopBeforeSmtp = true;
+        final String strHost = "mail.home.com";
+        final String strUsername = "user.name";
+        final String strPassword = "user.passwd";
 
         email.setPopBeforeSmtp(
             boolPopBeforeSmtp,
@@ -1147,7 +1147,7 @@ public class EmailTest extends AbstractE
         email.setCharset("ISO-8859-1");
         email.setContent("test content", "text/plain");
         email.buildMimeMessage();
-        MimeMessage msg = email.getMimeMessage();
+        final MimeMessage msg = email.getMimeMessage();
         msg.saveChanges();
         assertEquals("text/plain; charset=ISO-8859-1", msg.getContentType());
     }
@@ -1171,7 +1171,7 @@ public class EmailTest extends AbstractE
         email.setCharset("ISO-8859-1");
         email.setContent("test content", "text/plain; charset=US-ASCII");
         email.buildMimeMessage();
-        MimeMessage msg = email.getMimeMessage();
+        final MimeMessage msg = email.getMimeMessage();
         msg.saveChanges();
         assertEquals("text/plain; charset=US-ASCII", msg.getContentType());
     }
@@ -1194,7 +1194,7 @@ public class EmailTest extends AbstractE
         email.setCharset("ISO-8859-1");
         email.setContent("test content", "application/octet-stream");
         email.buildMimeMessage();
-        MimeMessage msg = email.getMimeMessage();
+        final MimeMessage msg = email.getMimeMessage();
         msg.saveChanges();
         assertEquals("application/octet-stream", msg.getContentType());
     }
@@ -1209,10 +1209,10 @@ public class EmailTest extends AbstractE
         email.setSubject("test mail");
 
         email.setCharset("ISO-8859-1");
-        File png = new File("./target/test-classes/images/logos/maven-feather.png");
+        final File png = new File("./target/test-classes/images/logos/maven-feather.png");
         email.setContent(png, "image/png");
         email.buildMimeMessage();
-        MimeMessage msg = email.getMimeMessage();
+        final MimeMessage msg = email.getMimeMessage();
         msg.saveChanges();
         assertEquals("image/png", msg.getContentType());
     }    

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java?rev=1606709&r1=1606708&r2=1606709&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java Mon Jun 30 12:26:06 2014
@@ -60,7 +60,7 @@ public class HtmlEmailTest extends Abstr
         // ====================================================================
         // Test Success
         // ====================================================================
-        for (String validChar : testCharsValid)
+        for (final String validChar : testCharsValid)
         {
             this.email.setTextMsg(validChar);
             assertEquals(validChar, this.email.getTextMsg());
@@ -69,14 +69,14 @@ public class HtmlEmailTest extends Abstr
         // ====================================================================
         // Test Exception
         // ====================================================================
-        for (String invalidChar : this.testCharsNotValid)
+        for (final String invalidChar : this.testCharsNotValid)
         {
             try
             {
                 this.email.setTextMsg(invalidChar);
                 fail("Should have thrown an exception");
             }
-            catch (EmailException e)
+            catch (final EmailException e)
             {
                 assertTrue(true);
             }
@@ -90,7 +90,7 @@ public class HtmlEmailTest extends Abstr
         // ====================================================================
         // Test Success
         // ====================================================================
-        for (String validChar : testCharsValid)
+        for (final String validChar : testCharsValid)
         {
             this.email.setHtmlMsg(validChar);
             assertEquals(validChar, this.email.getHtmlMsg());
@@ -99,14 +99,14 @@ public class HtmlEmailTest extends Abstr
         // ====================================================================
         // Test Exception
         // ====================================================================
-        for (String invalidChar : this.testCharsNotValid)
+        for (final String invalidChar : this.testCharsNotValid)
         {
             try
             {
                 this.email.setHtmlMsg(invalidChar);
                 fail("Should have thrown an exception");
             }
-            catch (EmailException e)
+            catch (final EmailException e)
             {
                 assertTrue(true);
             }
@@ -120,7 +120,7 @@ public class HtmlEmailTest extends Abstr
         // ====================================================================
         // Test Success
         // ====================================================================
-        for (String validChar : testCharsValid)
+        for (final String validChar : testCharsValid)
         {
             this.email.setMsg(validChar);
             assertEquals(validChar, this.email.getTextMsg());
@@ -132,14 +132,14 @@ public class HtmlEmailTest extends Abstr
         // ====================================================================
         // Test Exception
         // ====================================================================
-        for (String invalidChar : this.testCharsNotValid)
+        for (final String invalidChar : this.testCharsNotValid)
         {
             try
             {
                 this.email.setMsg(invalidChar);
                 fail("Should have thrown an exception");
             }
-            catch (EmailException e)
+            catch (final EmailException e)
             {
                 assertTrue(true);
             }
@@ -154,20 +154,20 @@ public class HtmlEmailTest extends Abstr
         // Test Success
         // ====================================================================
 
-        String strEmbed =
+        final String strEmbed =
             this.email.embed(new URL(this.strTestURL), "Test name");
         assertNotNull(strEmbed);
         assertEquals(HtmlEmail.CID_LENGTH, strEmbed.length());
 
         // if we embed the same name again, do we get the same content ID
         // back?
-        String testCid =
+        final String testCid =
             this.email.embed(new URL(this.strTestURL), "Test name");
         assertEquals(strEmbed, testCid);
 
         // if we embed the same URL under a different name, is the content ID
         // unique?
-        String newCid =
+        final String newCid =
             this.email.embed(new URL(this.strTestURL), "Test name 2");
         assertFalse(strEmbed.equals(newCid));
 
@@ -181,7 +181,7 @@ public class HtmlEmailTest extends Abstr
             this.email.embed(createInvalidURL(), "Bad URL");
             fail("Should have thrown an exception");
         }
-        catch (EmailException e)
+        catch (final EmailException e)
         {
             // expected
         }
@@ -193,7 +193,7 @@ public class HtmlEmailTest extends Abstr
             this.email.embed(new URL("http://www.google.com"), "Test name");
             fail("shouldn't be able to use an existing name with a different URL!");
         }
-        catch (EmailException e)
+        catch (final EmailException e)
         {
             // expected
         }
@@ -206,24 +206,24 @@ public class HtmlEmailTest extends Abstr
         // Test Success
         // ====================================================================
 
-        File file = File.createTempFile("testEmbedFile", "txt");
+        final File file = File.createTempFile("testEmbedFile", "txt");
         file.deleteOnExit();
-        String strEmbed = this.email.embed(file);
+        final String strEmbed = this.email.embed(file);
         assertNotNull(strEmbed);
         assertEquals("generated CID has wrong length",
                 HtmlEmail.CID_LENGTH, strEmbed.length());
 
         // if we embed the same file again, do we get the same content ID
         // back?
-        String testCid =
+        final String testCid =
             this.email.embed(file);
         assertEquals("didn't get same CID after embedding same file twice",
                 strEmbed, testCid);
 
         // if we embed a new file, is the content ID unique?
-        File otherFile = File.createTempFile("testEmbedFile2", "txt");
+        final File otherFile = File.createTempFile("testEmbedFile2", "txt");
         otherFile.deleteOnExit();
-        String newCid = this.email.embed(otherFile);
+        final String newCid = this.email.embed(otherFile);
         assertFalse("didn't get unique CID from embedding new file",
                 strEmbed.equals(newCid));
     }
@@ -231,12 +231,12 @@ public class HtmlEmailTest extends Abstr
     @Test
     public void testEmbedUrlAndFile() throws Exception
     {
-        File tmpFile = File.createTempFile("testfile", "txt");
+        final File tmpFile = File.createTempFile("testfile", "txt");
         tmpFile.deleteOnExit();
-        String fileCid = this.email.embed(tmpFile);
+        final String fileCid = this.email.embed(tmpFile);
 
-        URL fileUrl = tmpFile.toURI().toURL();
-        String urlCid = this.email.embed(fileUrl, "urlName");
+        final URL fileUrl = tmpFile.toURI().toURL();
+        final String urlCid = this.email.embed(fileUrl, "urlName");
 
         assertFalse("file and URL cids should be different even for same resource",
                 fileCid.equals(urlCid));
@@ -245,9 +245,9 @@ public class HtmlEmailTest extends Abstr
     @Test
     public void testEmbedDataSource() throws Exception
     {
-        File tmpFile = File.createTempFile("testEmbedDataSource", "txt");
+        final File tmpFile = File.createTempFile("testEmbedDataSource", "txt");
         tmpFile.deleteOnExit();
-        FileDataSource dataSource = new FileDataSource(tmpFile);
+        final FileDataSource dataSource = new FileDataSource(tmpFile);
 
         // does embedding a datasource without a name fail?
         try
@@ -255,29 +255,29 @@ public class HtmlEmailTest extends Abstr
             this.email.embed(dataSource, "");
             fail("embedding with an empty string for a name should fail");
         }
-        catch (EmailException e)
+        catch (final EmailException e)
         {
             // expected
         }
 
         // properly embed the datasource
-        String cid = this.email.embed(dataSource, "testname");
+        final String cid = this.email.embed(dataSource, "testname");
 
         // does embedding the same datasource under the same name return
         // the original cid?
-        String sameCid = this.email.embed(dataSource, "testname");
+        final String sameCid = this.email.embed(dataSource, "testname");
         assertEquals("didn't get same CID for embedding same datasource twice",
                 cid, sameCid);
 
         // does embedding another datasource under the same name fail?
-        File anotherFile = File.createTempFile("testEmbedDataSource2", "txt");
+        final File anotherFile = File.createTempFile("testEmbedDataSource2", "txt");
         anotherFile.deleteOnExit();
-        FileDataSource anotherDS = new FileDataSource(anotherFile);
+        final FileDataSource anotherDS = new FileDataSource(anotherFile);
         try
         {
             this.email.embed(anotherDS, "testname");
         }
-        catch (EmailException e)
+        catch (final EmailException e)
         {
             // expected
         }
@@ -290,7 +290,7 @@ public class HtmlEmailTest extends Abstr
     @Test
     public void testSend() throws EmailException, IOException
     {
-        EmailAttachment attachment = new EmailAttachment();
+        final EmailAttachment attachment = new EmailAttachment();
         File testFile = null;
 
         /** File to used to test file attachments (Must be valid) */
@@ -321,10 +321,10 @@ public class HtmlEmailTest extends Abstr
         this.email.setCharset(EmailConstants.ISO_8859_1);
         this.email.setSubject(strSubject);
 
-        URL url = new URL(EmailConfiguration.TEST_URL);
-        String cid = this.email.embed(url, "Apache Logo");
+        final URL url = new URL(EmailConfiguration.TEST_URL);
+        final String cid = this.email.embed(url, "Apache Logo");
 
-        String strHtmlMsg =
+        final String strHtmlMsg =
             "<html>The Apache logo - <img src=\"cid:" + cid + "\"><html>";
 
         this.email.setHtmlMsg(strHtmlMsg);
@@ -519,7 +519,7 @@ public class HtmlEmailTest extends Abstr
                 this.strTestPasswd);
         }
 
-        String strSubject = "Test HTML Send Subject (w default charset)";
+        final String strSubject = "Test HTML Send Subject (w default charset)";
         this.email.setSubject(strSubject);
         this.email.setMsg("Test txt msg ä"); // add non-ascii character, otherwise us-ascii will be used
 
@@ -549,7 +549,7 @@ public class HtmlEmailTest extends Abstr
     @Test
     public void testAddZipUrl() throws Exception
     {
-        String htmlMsg =
+        final String htmlMsg =
                 "Please click on the following link: <br><br>" +
                 "<a href=\"http://paradisedelivery.homeip.net/delivery/?file=3DTZC268X93337.zip\">" +
                 "http://paradisedelivery.homeip.net/delivery/?file=3DTZC268X93337.zip" +
@@ -571,7 +571,7 @@ public class HtmlEmailTest extends Abstr
                 this.strTestPasswd);
         }
 
-        String strSubject = "A dot (\".\") is appended to some ULRs of a HTML mail.";
+        final String strSubject = "A dot (\".\") is appended to some ULRs of a HTML mail.";
         this.email.setSubject(strSubject);
         this.email.setHtmlMsg(htmlMsg);
 
@@ -602,7 +602,7 @@ public class HtmlEmailTest extends Abstr
     @Test
     public void testCallingBuildMimeMessageBeforeSent() throws Exception {
 
-        String htmlMsg = "<b>Hello World</b>";
+        final String htmlMsg = "<b>Hello World</b>";
 
         this.email = new MockHtmlEmailConcrete();
         this.email.setHostName(this.strTestMailServer);
@@ -618,7 +618,7 @@ public class HtmlEmailTest extends Abstr
                 this.strTestPasswd);
         }
 
-        String strSubject = "testCallingBuildMimeMessageBeforeSent";
+        final String strSubject = "testCallingBuildMimeMessageBeforeSent";
         this.email.setSubject(strSubject);
         this.email.setHtmlMsg(htmlMsg);
 
@@ -629,7 +629,7 @@ public class HtmlEmailTest extends Abstr
         {
             this.email.send();
         }
-        catch(IllegalStateException e)
+        catch(final IllegalStateException e)
         {
             return;
         }
@@ -646,7 +646,7 @@ public class HtmlEmailTest extends Abstr
     {
         this.getMailServer();
 
-        String strSubject = "testSendWithPlainTextButNoHtmlContent";
+        final String strSubject = "testSendWithPlainTextButNoHtmlContent";
 
         this.email = new MockHtmlEmailConcrete();
         this.email.setHostName(this.strTestMailServer);
@@ -690,20 +690,20 @@ public class HtmlEmailTest extends Abstr
          // Test Success
          // ====================================================================
 
-         File file = File.createTempFile("testEmbedFile", "txt");
+         final File file = File.createTempFile("testEmbedFile", "txt");
          file.deleteOnExit();
 
-         String testCid = "Test CID";
-         String encodedCid = EmailUtils.encodeUrl(testCid);
+         final String testCid = "Test CID";
+         final String encodedCid = EmailUtils.encodeUrl(testCid);
 
          // if we embed a new file, do we get the content ID we specified back?
-         String strEmbed = this.email.embed(file, testCid);
+         final String strEmbed = this.email.embed(file, testCid);
          assertNotNull(strEmbed);
          assertEquals("didn't get same CID when embedding with a specified CID", encodedCid, strEmbed);
 
          // if we embed the same file again, do we get the same content ID
          // back?
-         String returnedCid = this.email.embed(file);
+         final String returnedCid = this.email.embed(file);
          assertEquals("didn't get same CID after embedding same file twice", encodedCid, returnedCid);
     }
 
@@ -715,27 +715,27 @@ public class HtmlEmailTest extends Abstr
         assertCorrectContentType("contentTypeTest.png", "image/png");
     }
 
-    private void assertCorrectContentType(String picture, String contentType) throws Exception {
-        HtmlEmail htmlEmail = createDefaultHtmlEmail();
-        String cid = htmlEmail.embed(new File("./src/test/resources/images/" + picture), "Apache Logo");
-        String htmlMsg = "<html><img src=\"cid:" + cid + "\"><html>";
+    private void assertCorrectContentType(final String picture, final String contentType) throws Exception {
+        final HtmlEmail htmlEmail = createDefaultHtmlEmail();
+        final String cid = htmlEmail.embed(new File("./src/test/resources/images/" + picture), "Apache Logo");
+        final String htmlMsg = "<html><img src=\"cid:" + cid + "\"><html>";
         htmlEmail.setHtmlMsg(htmlMsg);
         htmlEmail.buildMimeMessage();
 
-        MimeMessage mm = htmlEmail.getMimeMessage();
+        final MimeMessage mm = htmlEmail.getMimeMessage();
         mm.saveChanges();
-        MimeMessageParser mmp = new MimeMessageParser(mm);
+        final MimeMessageParser mmp = new MimeMessageParser(mm);
         mmp.parse();
 
-        List<?> attachments = mmp.getAttachmentList();
+        final List<?> attachments = mmp.getAttachmentList();
         assertEquals("Attachment size", 1, attachments.size());
 
-        DataSource ds = (DataSource) attachments.get(0);
+        final DataSource ds = (DataSource) attachments.get(0);
         assertEquals("Content type", contentType, ds.getContentType());
     }
 
     private HtmlEmail createDefaultHtmlEmail() throws EmailException {
-        HtmlEmail htmlEmail = new HtmlEmail();
+        final HtmlEmail htmlEmail = new HtmlEmail();
         htmlEmail.setHostName(this.strTestMailServer);
         htmlEmail.setSmtpPort(this.getMailServerPort());
         htmlEmail.setFrom("a@b.com");

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/ImageHtmlEmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/ImageHtmlEmailTest.java?rev=1606709&r1=1606708&r2=1606709&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/ImageHtmlEmailTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/ImageHtmlEmailTest.java Mon Jun 30 12:26:06 2014
@@ -68,7 +68,7 @@ public class ImageHtmlEmailTest extends 
         // Create the email message
         getMailServer();
 
-        String strSubject = "Test HTML Send default";
+        final String strSubject = "Test HTML Send default";
 
         email = new MockImageHtmlEmailConcrete();
         email.setDataSourceResolver(new DataSourceUrlResolver(TEST_IMAGE_DIR.toURI().toURL(), TEST_IS_LENIENT));
@@ -78,7 +78,7 @@ public class ImageHtmlEmailTest extends 
         email.addTo(strTestMailTo);
         email.setSubject(strSubject);
 
-        String html = loadUrlContent(TEST_HTML_URL);
+        final String html = loadUrlContent(TEST_HTML_URL);
 
         // set the html message
         email.setHtmlMsg(html);
@@ -92,9 +92,9 @@ public class ImageHtmlEmailTest extends 
         fakeMailServer.stop();
 
         assertEquals(1, fakeMailServer.getMessages().size());
-        MimeMessage mimeMessage = fakeMailServer.getMessages().get(0).getMimeMessage();
+        final MimeMessage mimeMessage = fakeMailServer.getMessages().get(0).getMimeMessage();
 
-        MimeMessageParser mimeMessageParser = new MimeMessageParser(mimeMessage).parse();
+        final MimeMessageParser mimeMessageParser = new MimeMessageParser(mimeMessage).parse();
         assertTrue(mimeMessageParser.getHtmlContent().contains("\"cid:"));
         assertTrue(mimeMessageParser.getAttachmentList().size() == 3);
     }
@@ -104,13 +104,13 @@ public class ImageHtmlEmailTest extends 
         Logger.getLogger(ImageHtmlEmail.class.getName()).setLevel(Level.FINEST);
 
         // Create the email message
-        ImageHtmlEmail email = new ImageHtmlEmail();
+        final ImageHtmlEmail email = new ImageHtmlEmail();
 
         // set the html message
         try {
             email.setHtmlMsg(null);
             fail("Should fail here!");
-        } catch (EmailException e) {
+        } catch (final EmailException e) {
             assertTrue(e.getMessage(), e.getMessage().contains("Invalid message supplied"));
         }
     }
@@ -120,13 +120,13 @@ public class ImageHtmlEmailTest extends 
         Logger.getLogger(ImageHtmlEmail.class.getName()).setLevel(Level.FINEST);
 
         // Create the email message
-        ImageHtmlEmail email = new ImageHtmlEmail();
+        final ImageHtmlEmail email = new ImageHtmlEmail();
 
         // set the html message
         try {
             email.setHtmlMsg("");
             fail("Should fail here!");
-        } catch (EmailException e) {
+        } catch (final EmailException e) {
             assertTrue(e.getMessage(), e.getMessage().contains("Invalid message supplied"));
         }
 
@@ -138,7 +138,7 @@ public class ImageHtmlEmailTest extends 
 
         getMailServer();
 
-        String strSubject = "Test HTML Send default with URL";
+        final String strSubject = "Test HTML Send default with URL";
 
         // Create the email message
         email = new MockImageHtmlEmailConcrete();
@@ -171,7 +171,7 @@ public class ImageHtmlEmailTest extends 
         // Create the email message
         getMailServer();
 
-        String strSubject = "Test HTML Send default with absolute local path";
+        final String strSubject = "Test HTML Send default with absolute local path";
 
         // Create the email message
         email = new MockImageHtmlEmailConcrete();
@@ -182,7 +182,7 @@ public class ImageHtmlEmailTest extends 
         email.setSubject(strSubject);
         email.setDataSourceResolver(new DataSourceUrlResolver(TEST_IMAGE_DIR.toURI().toURL(), TEST_IS_LENIENT));
 
-        File file = File.createTempFile("emailtest", ".tst");
+        final File file = File.createTempFile("emailtest", ".tst");
         FileUtils.writeStringToFile(file,
                 "just some silly data that we won't be able to display anyway");
 
@@ -208,7 +208,7 @@ public class ImageHtmlEmailTest extends 
         // Create the email message
         getMailServer();
 
-        String strSubject = "Test HTML Send default";
+        final String strSubject = "Test HTML Send default";
 
         email = new MockImageHtmlEmailConcrete();
         email.setDataSourceResolver(new DataSourceClassPathResolver("/", TEST_IS_LENIENT));
@@ -218,7 +218,7 @@ public class ImageHtmlEmailTest extends 
         email.addTo(strTestMailTo);
         email.setSubject(strSubject);
 
-        String html = loadUrlContent(TEST2_HTML_URL);
+        final String html = loadUrlContent(TEST2_HTML_URL);
 
         // set the html message
         email.setHtmlMsg(html);
@@ -232,10 +232,10 @@ public class ImageHtmlEmailTest extends 
         fakeMailServer.stop();
 
         assertEquals(1, fakeMailServer.getMessages().size());
-        MimeMessage mimeMessage = fakeMailServer.getMessages().get(0).getMimeMessage();
+        final MimeMessage mimeMessage = fakeMailServer.getMessages().get(0).getMimeMessage();
         MimeMessageUtils.writeMimeMessage(mimeMessage, new File("./target/test-emails/testSendHTMLClassPathFile.eml"));
 
-        MimeMessageParser mimeMessageParser = new MimeMessageParser(mimeMessage).parse();
+        final MimeMessageParser mimeMessageParser = new MimeMessageParser(mimeMessage).parse();
         assertTrue(mimeMessageParser.getHtmlContent().contains("\"cid:"));
         assertTrue(mimeMessageParser.getAttachmentList().size() == 1);
     }
@@ -247,10 +247,10 @@ public class ImageHtmlEmailTest extends 
         // Create the email message
         getMailServer();
 
-        String strSubject = "Test HTML Send default";
+        final String strSubject = "Test HTML Send default";
 
         email = new MockImageHtmlEmailConcrete();
-        DataSourceResolver dataSourceResolvers[] = new DataSourceResolver[2];
+        final DataSourceResolver dataSourceResolvers[] = new DataSourceResolver[2];
         dataSourceResolvers[0] = new DataSourceUrlResolver(new URL("http://foo"), true);
         dataSourceResolvers[1] = new DataSourceClassPathResolver("/", true);
 
@@ -261,7 +261,7 @@ public class ImageHtmlEmailTest extends 
         email.addTo(strTestMailTo);
         email.setSubject(strSubject);
 
-        String html = loadUrlContent(TEST2_HTML_URL);
+        final String html = loadUrlContent(TEST2_HTML_URL);
 
         // set the html message
         email.setHtmlMsg(html);
@@ -275,10 +275,10 @@ public class ImageHtmlEmailTest extends 
         fakeMailServer.stop();
 
         assertEquals(1, fakeMailServer.getMessages().size());
-        MimeMessage mimeMessage = fakeMailServer.getMessages().get(0).getMimeMessage();
+        final MimeMessage mimeMessage = fakeMailServer.getMessages().get(0).getMimeMessage();
         MimeMessageUtils.writeMimeMessage(mimeMessage, new File("./target/test-emails/testSendHTMLAutoFile.eml"));
 
-        MimeMessageParser mimeMessageParser = new MimeMessageParser(mimeMessage).parse();
+        final MimeMessageParser mimeMessageParser = new MimeMessageParser(mimeMessage).parse();
         assertTrue(mimeMessageParser.getHtmlContent().contains("\"cid:"));
         assertTrue(mimeMessageParser.getAttachmentList().size() == 1);
     }
@@ -290,10 +290,10 @@ public class ImageHtmlEmailTest extends 
         // Create the email message
         getMailServer();
 
-        String strSubject = "Test HTML Send default";
+        final String strSubject = "Test HTML Send default";
 
         email = new MockImageHtmlEmailConcrete();
-        DataSourceResolver dataSourceResolver = new DataSourceClassPathResolver("/", true);
+        final DataSourceResolver dataSourceResolver = new DataSourceClassPathResolver("/", true);
 
         email.setDataSourceResolver(dataSourceResolver);
         email.setHostName(strTestMailServer);
@@ -302,7 +302,7 @@ public class ImageHtmlEmailTest extends 
         email.addTo(strTestMailTo);
         email.setSubject(strSubject);
 
-        String html = "<p>First image  <img src=\"images/contentTypeTest.gif\"/></p>" +
+        final String html = "<p>First image  <img src=\"images/contentTypeTest.gif\"/></p>" +
                       "<p>Second image <img src=\"images/contentTypeTest.jpg\"/></p>" +
                       "<p>Third image  <img src=\"images/contentTypeTest.png\"/></p>";
 
@@ -318,17 +318,17 @@ public class ImageHtmlEmailTest extends 
         fakeMailServer.stop();
 
         assertEquals(1, fakeMailServer.getMessages().size());
-        MimeMessage mimeMessage = fakeMailServer.getMessages().get(0).getMimeMessage();
+        final MimeMessage mimeMessage = fakeMailServer.getMessages().get(0).getMimeMessage();
         MimeMessageUtils.writeMimeMessage(mimeMessage, new File("./target/test-emails/testSendHTMLAutoMultipleFiles.eml"));
 
-        MimeMessageParser mimeMessageParser = new MimeMessageParser(mimeMessage).parse();
+        final MimeMessageParser mimeMessageParser = new MimeMessageParser(mimeMessage).parse();
         assertTrue(mimeMessageParser.getHtmlContent().contains("\"cid:"));
         assertTrue(mimeMessageParser.getAttachmentList().size() == 3);
     }
 
     @Test
     public void testRegex() {
-        Pattern pattern = Pattern.compile(ImageHtmlEmail.REGEX_IMG_SRC);
+        final Pattern pattern = Pattern.compile(ImageHtmlEmail.REGEX_IMG_SRC);
 
         // ensure that the regex that we use is catching the cases correctly
         Matcher matcher = pattern
@@ -411,7 +411,7 @@ public class ImageHtmlEmailTest extends 
 
         getMailServer();
 
-        String strSubject = "Test HTML Send default with URL";
+        final String strSubject = "Test HTML Send default with URL";
 
         // Create the email message
         email = new MockImageHtmlEmailConcrete();
@@ -435,12 +435,12 @@ public class ImageHtmlEmailTest extends 
                      email.getCcAddresses(), email.getBccAddresses(), true);
     }
     
-    private String loadUrlContent(URL url) throws IOException {
-        InputStream stream = url.openStream();
-        StringBuilder html = new StringBuilder();
+    private String loadUrlContent(final URL url) throws IOException {
+        final InputStream stream = url.openStream();
+        final StringBuilder html = new StringBuilder();
         try {
-            List<String> lines = IOUtils.readLines(stream);
-            for (String line : lines) {
+            final List<String> lines = IOUtils.readLines(stream);
+            for (final String line : lines) {
                 html.append(line).append("\n");
             }
         } finally {

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidAddressTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidAddressTest.java?rev=1606709&r1=1606708&r2=1606709&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidAddressTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidAddressTest.java Mon Jun 30 12:26:06 2014
@@ -92,7 +92,7 @@ public class InvalidAddressTest extends 
                 // Expected an exception to be thrown
                 fail("setFrom " + i + " passed: " + ARR_INVALID_EMAILS[i]);
             }
-            catch (EmailException ignore)
+            catch (final EmailException ignore)
             {
                 // Expected Result
             }
@@ -116,7 +116,7 @@ public class InvalidAddressTest extends 
                 // Expected an exception to be thrown
                 fail("addTo " + i + " passed: " + ARR_INVALID_EMAILS[i]);
             }
-            catch (EmailException ignore)
+            catch (final EmailException ignore)
             {
                 // Expected Result
             }
@@ -140,7 +140,7 @@ public class InvalidAddressTest extends 
                 // Expected an exception to be thrown
                 fail("addCc " + i + " passed: " + ARR_INVALID_EMAILS[i]);
             }
-            catch (EmailException ignore)
+            catch (final EmailException ignore)
             {
                 // Expected Result
             }
@@ -164,7 +164,7 @@ public class InvalidAddressTest extends 
                 // Expected an exception to be thrown
                 fail("addBcc " + i + " passed: " + ARR_INVALID_EMAILS[i]);
             }
-            catch (EmailException ignore)
+            catch (final EmailException ignore)
             {
                 // Expected Result
             }

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidInternetAddressTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidInternetAddressTest.java?rev=1606709&r1=1606708&r2=1606709&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidInternetAddressTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidInternetAddressTest.java Mon Jun 30 12:26:06 2014
@@ -85,7 +85,7 @@ public class InvalidInternetAddressTest 
         {
             validateMethod = InternetAddress.class.getMethod("validate", new Class [0]);
         }
-        catch (Exception e)
+        catch (final Exception e)
         {
             assertEquals("Got wrong Exception when looking for validate()", NoSuchMethodException.class, e.getClass());
         }
@@ -111,7 +111,7 @@ public class InvalidInternetAddressTest 
                 // Expected an exception to be thrown
                 fail("Strict " + i + " passed: " + ARR_INVALID_EMAILS[i]);
             }
-            catch (Exception ex)
+            catch (final Exception ex)
             {
                 // Expected Result
             }
@@ -126,7 +126,7 @@ public class InvalidInternetAddressTest 
             new InternetAddress(VALID_QUOTED_EMAIL);
 
         }
-        catch (Exception ex)
+        catch (final Exception ex)
         {
             fail("Valid Quoted Email failed: " + VALID_QUOTED_EMAIL
                 + " - " + ex.getMessage());
@@ -149,12 +149,12 @@ public class InvalidInternetAddressTest 
         for (int i = 0; i < ARR_INVALID_EMAILS.length; i++)
         {
 
-            InternetAddress address = new InternetAddress(ARR_INVALID_EMAILS[i], "Joe");
+            final InternetAddress address = new InternetAddress(ARR_INVALID_EMAILS[i], "Joe");
 
             // N.B. validate() doesn't check addresses containing quotes or '['
-            boolean quoted = ARR_INVALID_EMAILS[i].contains("\"");
-            int atIndex    = ARR_INVALID_EMAILS[i].indexOf("@");
-            boolean domainBracket  = (atIndex >= 0)
+            final boolean quoted = ARR_INVALID_EMAILS[i].contains("\"");
+            final int atIndex    = ARR_INVALID_EMAILS[i].indexOf("@");
+            final boolean domainBracket  = (atIndex >= 0)
                 && (ARR_INVALID_EMAILS[i].indexOf("[", atIndex)  >= 0);
             try
             {
@@ -165,7 +165,7 @@ public class InvalidInternetAddressTest 
                     fail("Validate " + i + " passed: " + ARR_INVALID_EMAILS[i]);
                 }
             }
-            catch (Exception ex)
+            catch (final Exception ex)
             {
                 if (quoted || domainBracket)
                 {
@@ -180,7 +180,7 @@ public class InvalidInternetAddressTest 
         {
             validateMethod.invoke(new InternetAddress(VALID_QUOTED_EMAIL, "Joe"), (Object[]) null);
         }
-        catch (Exception ex)
+        catch (final Exception ex)
         {
             fail("Valid Quoted Email failed: " + VALID_QUOTED_EMAIL
                 + " - " + ex.getMessage());
@@ -203,12 +203,12 @@ public class InvalidInternetAddressTest 
         for (int i = 0; i < ARR_INVALID_EMAILS.length; i++)
         {
 
-            InternetAddress address = new InternetAddress(ARR_INVALID_EMAILS[i], "Joe", "UTF-8");
+            final InternetAddress address = new InternetAddress(ARR_INVALID_EMAILS[i], "Joe", "UTF-8");
 
             // N.B. validate() doesn't check addresses containing quotes or '['
-            boolean quoted = ARR_INVALID_EMAILS[i].contains("\"");
-            int atIndex    = ARR_INVALID_EMAILS[i].indexOf("@");
-            boolean domainBracket  = (atIndex >= 0)
+            final boolean quoted = ARR_INVALID_EMAILS[i].contains("\"");
+            final int atIndex    = ARR_INVALID_EMAILS[i].indexOf("@");
+            final boolean domainBracket  = (atIndex >= 0)
                 && (ARR_INVALID_EMAILS[i].indexOf("[", atIndex)  >= 0);
 
             try
@@ -220,7 +220,7 @@ public class InvalidInternetAddressTest 
                 }
 
             }
-            catch (Exception ex)
+            catch (final Exception ex)
             {
 
                 if (quoted || domainBracket)
@@ -238,7 +238,7 @@ public class InvalidInternetAddressTest 
         {
             validateMethod.invoke(new InternetAddress(VALID_QUOTED_EMAIL, "Joe", "UTF-8"), (Object[]) null);
         }
-        catch (Exception ex)
+        catch (final Exception ex)
         {
             fail("Valid Quoted Email failed: " + VALID_QUOTED_EMAIL
                 + " - " + ex.getMessage());