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 2023/12/14 01:28:33 UTC
(commons-email) 01/03: Internal refactoring
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-email.git
commit c9f93182546b09ff161f6d10b82a5437b3075ef1
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Dec 13 16:22:17 2023 -0500
Internal refactoring
---
src/main/java/org/apache/commons/mail/Email.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/mail/Email.java b/src/main/java/org/apache/commons/mail/Email.java
index 515e6f4..596ef28 100644
--- a/src/main/java/org/apache/commons/mail/Email.java
+++ b/src/main/java/org/apache/commons/mail/Email.java
@@ -334,7 +334,7 @@ public abstract class Email {
* @since 1.3
*/
public Email addBcc(final String... emails) throws EmailException {
- if (emails == null || emails.length == 0) {
+ if (isEmpty(emails)) {
throw new EmailException("Address List provided was invalid");
}
@@ -400,7 +400,7 @@ public abstract class Email {
* @since 1.3
*/
public Email addCc(final String... emails) throws EmailException {
- if (emails == null || emails.length == 0) {
+ if (isEmpty(emails)) {
throw new EmailException("Address List provided was invalid");
}
@@ -529,7 +529,7 @@ public abstract class Email {
* @since 1.3
*/
public Email addTo(final String... emails) throws EmailException {
- if (emails == null || emails.length == 0) {
+ if (isEmpty(emails)) {
throw new EmailException("Address List provided was invalid");
}
@@ -982,6 +982,10 @@ public abstract class Email {
return this.toList;
}
+ private boolean isEmpty(final String[] array) {
+ return array == null || array.length == 0;
+ }
+
/**
* If partial sending of email enabled.
*