commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r512208 - /jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/InvalidInternetAddressTest.java
Date Tue, 27 Feb 2007 10:22:29 GMT
Author: dion
Date: Tue Feb 27 02:22:28 2007
New Revision: 512208

URL: http://svn.apache.org/viewvc?view=rev&rev=512208
Log:
checkstyle fixes

Modified:
    jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/InvalidInternetAddressTest.java

Modified: jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/InvalidInternetAddressTest.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/InvalidInternetAddressTest.java?view=diff&rev=512208&r1=512207&r2=512208
==============================================================================
--- jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/InvalidInternetAddressTest.java
(original)
+++ jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/InvalidInternetAddressTest.java
Tue Feb 27 02:22:28 2007
@@ -35,7 +35,7 @@
     private static final String VALID_QUOTED_EMAIL = "\"John O'Groats\"@domain.com";
 
     /** JavaMail 1.2. does not know about this */
-    private static Method validateMethod = null;
+    private static Method validateMethod;
 
     /** */
     private static final String[] ARR_INVALID_EMAILS =
@@ -79,6 +79,10 @@
         super(name);
     }
 
+    /**
+     * Setup for a test
+     * @throws Exception on any error
+     */
     protected void setUp() throws Exception
     {
         super.setUp();
@@ -108,29 +112,33 @@
         for (int i = 0; i < ARR_INVALID_EMAILS.length; i++)
         {
 
-            try {
-
+            try
+            {
                 // Create Internet Address using "strict" constructor
                 new InternetAddress(ARR_INVALID_EMAILS[i]);
 
                 // Expected an exception to be thrown
                 fail("Strict " + i + " passed: " + ARR_INVALID_EMAILS[i]);
-
-            } catch (Exception ex) {
+            }
+            catch (Exception ex)
+            {
                 // Expected Result
             }
 
         }
 
         // test valid 'quoted' Email addresses
-        try {
+        try
+        {
 
             // Create Internet Address using "strict" constructor
             new InternetAddress(VALID_QUOTED_EMAIL);
 
-        } catch (Exception ex) {
-            fail("Valid Quoted Email failed: " + VALID_QUOTED_EMAIL +
-                 " - " + ex.getMessage());
+        }
+        catch (Exception ex)
+        {
+            fail("Valid Quoted Email failed: " + VALID_QUOTED_EMAIL
+                + " - " + ex.getMessage());
         }
     }
 
@@ -156,39 +164,39 @@
             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].indexOf("\"") >= 0);
+            boolean quoted = ARR_INVALID_EMAILS[i].indexOf("\"") >= 0;
             int atIndex    = ARR_INVALID_EMAILS[i].indexOf("@");
-            boolean domainBracket  = (atIndex >= 0) &&
-                                     (ARR_INVALID_EMAILS[i].indexOf("[", atIndex)  >=
0);
-            try {
-
+            boolean domainBracket  = (atIndex >= 0)
+                && (ARR_INVALID_EMAILS[i].indexOf("[", atIndex)  >= 0);
+            try
+            {
                 validateMethod.invoke(address, null);
 
-                if (!(quoted || domainBracket)) {
+                if (!(quoted || domainBracket))
+                {
                     fail("Validate " + i + " passed: " + ARR_INVALID_EMAILS[i]);
                 }
-
-            } catch (Exception ex) {
-
-                if (quoted || domainBracket) {
-                    fail("Validate " + i + " failed: " + ARR_INVALID_EMAILS[i] +
-                         " - " + ex.getMessage());
+            }
+            catch (Exception ex)
+            {
+                if (quoted || domainBracket)
+                {
+                    fail("Validate " + i + " failed: " + ARR_INVALID_EMAILS[i]
+                        + " - " + ex.getMessage());
                 }
-
             }
-
         }
 
         // test valid 'quoted' Email addresses
-        try {
-
+        try
+        {
             validateMethod.invoke(new InternetAddress(VALID_QUOTED_EMAIL, "Joe"), null);
-
-        } catch (Exception ex) {
-            fail("Valid Quoted Email failed: " + VALID_QUOTED_EMAIL +
-                 " - " + ex.getMessage());
         }
-
+        catch (Exception ex)
+        {
+            fail("Valid Quoted Email failed: " + VALID_QUOTED_EMAIL
+                + " - " + ex.getMessage());
+        }
     }
 
     /**
@@ -213,24 +221,27 @@
             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].indexOf("\"") >= 0);
+            boolean quoted = ARR_INVALID_EMAILS[i].indexOf("\"") >= 0;
             int atIndex    = ARR_INVALID_EMAILS[i].indexOf("@");
-            boolean domainBracket  = (atIndex >= 0) &&
-                                     (ARR_INVALID_EMAILS[i].indexOf("[", atIndex)  >=
0);
-
-            try {
+            boolean domainBracket  = (atIndex >= 0)
+                && (ARR_INVALID_EMAILS[i].indexOf("[", atIndex)  >= 0);
 
+            try
+            {
                 validateMethod.invoke(address, null);
-
-                if (!(quoted || domainBracket)) {
+                if (!(quoted || domainBracket))
+                {
                     fail("Validate " + i + " passed: " + ARR_INVALID_EMAILS[i]);
                 }
 
-            } catch (Exception ex) {
+            }
+            catch (Exception ex)
+            {
 
-                if (quoted || domainBracket) {
-                    fail("Validate " + i + " failed: " + ARR_INVALID_EMAILS[i] +
-                         " - " + ex.getMessage());
+                if (quoted || domainBracket)
+                {
+                    fail("Validate " + i + " failed: " + ARR_INVALID_EMAILS[i]
+                        + " - " + ex.getMessage());
                 }
 
             }
@@ -238,13 +249,14 @@
         }
 
         // test valid 'quoted' Email addresses
-        try {
-
+        try
+        {
             validateMethod.invoke(new InternetAddress(VALID_QUOTED_EMAIL, "Joe", "UTF-8"),
null);
-
-        } catch (Exception ex) {
-            fail("Valid Quoted Email failed: " + VALID_QUOTED_EMAIL +
-                 " - " + ex.getMessage());
+        }
+        catch (Exception ex)
+        {
+            fail("Valid Quoted Email failed: " + VALID_QUOTED_EMAIL
+                + " - " + ex.getMessage());
         }
     }
 



---------------------------------------------------------------------
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