You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2006/12/28 00:45:02 UTC

svn commit: r490602 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java

Author: peterreilly
Date: Wed Dec 27 15:45:01 2006
New Revision: 490602

URL: http://svn.apache.org/viewvc?view=rev&rev=490602
Log:
checkstyle: make method a little smaller

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java?view=diff&rev=490602&r1=490601&r2=490602
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java Wed Dec 27 15:45:01 2006
@@ -420,9 +420,7 @@
                     autoFound = true;
                     log("Using MIME mail", Project.MSG_VERBOSE);
                 } catch (BuildException e) {
-                    Throwable t = e.getCause() == null ? e : e.getCause();
-                    log("Failed to initialise MIME mail: " + t.getMessage(),
-                            Project.MSG_WARN);
+                    logBuildException("Failed to initialise MIME mail: ", e);
                     return;
                 }
             }
@@ -446,9 +444,7 @@
                     autoFound = true;
                     log("Using UU mail", Project.MSG_VERBOSE);
                 } catch (BuildException e) {
-                    Throwable t = e.getCause() == null ? e : e.getCause();
-                    log("Failed to initialise UU mail: " + t.getMessage(),
-                            Project.MSG_WARN);
+                    logBuildException("Failed to initialise UU mail: ", e);
                     return;
                 }
             }
@@ -540,8 +536,7 @@
             log("Sent email with " + count + " attachment"
                  + (count == 1 ? "" : "s"), Project.MSG_INFO);
         } catch (BuildException e) {
-            Throwable t = e.getCause() == null ? e : e.getCause();
-            log("Failed to send email: " + t.getMessage(), Project.MSG_WARN);
+            logBuildException("Failed to send email: ", e);
             if (failOnError) {
                 throw e;
             }
@@ -553,6 +548,11 @@
         } finally {
             message = savedMessage;
         }
+    }
+
+    private void logBuildException(String reason, BuildException e) {
+        Throwable t = e.getCause() == null ? e : e.getCause();
+        log(reason + t.getMessage(), Project.MSG_WARN);
     }
 
     /**



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