allow attachment removal
This commit is contained in:
parent
9f7829b28a
commit
57db456a80
|
@ -107,15 +107,20 @@ public class MessageBuilder {
|
|||
}
|
||||
|
||||
public MessageBuilder setAttachment(Attachment type, String cont) {
|
||||
if(cont == null) {
|
||||
if(type != Attachment.none) throw new IllegalArgumentException("cont == null requires type == none");
|
||||
attachmenttype = type;
|
||||
attachment = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
if(attachmenttype != Attachment.none) {
|
||||
throw new IllegalArgumentException("You can only attach one thing!");
|
||||
}
|
||||
if(cont == null) {
|
||||
throw new IllegalArgumentException("attachment empty!");
|
||||
}
|
||||
|
||||
attachmenttype = type;
|
||||
try {
|
||||
attachment = URLEncoder.encode(cont, "UTF-8");
|
||||
attachment = URLEncoder.encode(cont, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue