Skip to content

Commit

Permalink
Ensure that correct setters are used for cc and bcc map entries.
Browse files Browse the repository at this point in the history
  • Loading branch information
Corneil du Plessis corneil.duplessis@gmail.com authored and Corneil du Plessis corneil.duplessis@gmail.com committed Oct 3, 2014
1 parent 4b73013 commit 437865b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions core/src/main/groovyx/gaelyk/extensions/MailExtensions.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,22 @@ public class MailExtensions {
else throw new IllegalArgumentException("Headers must be collection of Header objects");
break;
case "to":
if (v instanceof Collection<?>) msg.setTo((Collection<String>) v);
else msg.setTo(Arrays.asList(new String[] { String.valueOf(v) }));
if (v instanceof Collection<?>)
msg.setTo((Collection<String>) v);
else
msg.setTo(String.valueOf(v));
break;
case "bcc":
if (v instanceof Collection<?>) msg.setTo((Collection<String>) v);
else msg.setTo(Arrays.asList(new String[] { String.valueOf(v) }));
if (v instanceof Collection<?>)
msg.setBcc((Collection<String>) v);
else
msg.setBcc(String.valueOf(v));
break;
case "cc":
if (v instanceof Collection<?>) msg.setTo((Collection<String>) v);
else msg.setTo(Arrays.asList(new String[] { String.valueOf(v) }));
if (v instanceof Collection<?>)
msg.setCc((Collection<String>) v);
else
msg.setCc(String.valueOf(v));
break;
case "from":
case "sender":
Expand Down

0 comments on commit 437865b

Please sign in to comment.