From 3ed946bae41d5528a2b4762c20efb8dc74b71519 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Wed, 27 Dec 2006 23:45:01 +0000 Subject: [PATCH] checkstyle: make method a little smaller git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@490602 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/taskdefs/email/EmailTask.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java b/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java index f49d66953..a8557d8db 100644 --- a/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java @@ -420,9 +420,7 @@ public class EmailTask extends Task { 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 @@ public class EmailTask extends Task { 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 @@ public class EmailTask extends Task { 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; } @@ -555,6 +550,11 @@ public class EmailTask extends Task { } } + private void logBuildException(String reason, BuildException e) { + Throwable t = e.getCause() == null ? e : e.getCause(); + log(reason + t.getMessage(), Project.MSG_WARN); + } + /** * Sets the character set of mail message. * Will be ignored if mimeType contains ....; Charset=... substring or