[MAGNOLIA-6030] info.magnolia.module.mail.templates.MgnlEmail.EMAIL_WITH_PERSONAL_PATTERN is wrong and superfluous Created: 05/Jan/15 Updated: 02/Jun/15 Resolved: 05/Jan/15 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 4.5.25 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Robert Šiška | Assignee: | Robert Šiška |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Patch included: |
Yes
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Description |
|
The pattern is used in info.magnolia.module.mail.templates.MgnlEmail.setFrom(String). If you call e.g. setFrom("Felix Rabe <felix.rabe@magnolia-cms.com>") which is completely valid, it will go down the "else" branch, as the regular expression does not match anything without '"'s or anything with a whitespace before "<". I propose to shorten the code to just: public void setFrom(String _from) { try { InternetAddress address = new InternetAddress(_from, True); this.setFrom(address); } catch (Exception e) { log.error("Could not set from field of email:" + e.getMessage()); } } and remove the wrong pattern altogether. |