code:
Attendee dev = new Attendee(URI.create("mailto:" + address));
dev.getParameters().add(Role.REQ_PARTICIPANT);
exception:
<2017-02-20, 13:37:36> <WARN> <com.services.EmailServiceImpl> Unexpected Exception when send email.
java.lang.IllegalArgumentException
at java.net.URI.create(Unknown Source)
at com.service.utils.CalendarUtil.addAtendees(CalendarUtil.java:206)
at com.service.utils.CalendarUtil.getMeetingCalendar(CalendarUtil.java:170)
at com.service.shared.EmailAttachment.toBodyPart(EmailAttachment.java:114)
at com.services.EmailServiceImpl$SmtpSendEmailTask.sendMail(EmailServiceImpl.java:877)
at com.services.EmailServiceImpl$SendEmailTask.sendMailSession(EmailServiceImpl.java:607)
at com.services.EmailServiceImpl$SendEmailTask.run(EmailServiceImpl.java:640)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 20: mailto:zh@sina.com
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.checkChars(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.<init>(Unknown Source)
... 15 more
reason:
是因为邮件有空格,构建uri的时候报错;