[ 
http://jira.magnolia-cms.com/browse/MAGNOLIA-3371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Felix Rabe updated MAGNOLIA-3371:
---------------------------------

    Description: 
The pattern is used in 
info.magnolia.module.mail.templates.MgnlEmail.setFrom(String).  If you call 
e.g. setFrom("Felix Rabe <felix.r...@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:

{code}
    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());
        }
    }
{code}

and remove the wrong pattern altogether.

  was:
The pattern is used in 
info.magnolia.module.mail.templates.MgnlEmail.setFrom(String).  If you call 
e.g. setFrom("Felix Rabe <felix.r...@magnolia-cms.com>") which is completely 
valid, it will go down the "else" branch, as the regular expression does not 
match anything without '"'s and anything with a whitespace.

I propose to shorten the code to just:

{code}
    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());
        }
    }
{code}

and remove the wrong pattern altogether.


> info.magnolia.module.mail.templates.MgnlEmail.EMAIL_WITH_PERSONAL_PATTERN is 
> wrong and superfluous
> --------------------------------------------------------------------------------------------------
>
>                 Key: MAGNOLIA-3371
>                 URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-3371
>             Project: Magnolia
>          Issue Type: Bug
>          Components: mail
>    Affects Versions: 4.3.8, 4.3.x, 4.4.x, 5.0
>            Reporter: Felix Rabe
>            Assignee: Boris Kraft
>
> The pattern is used in 
> info.magnolia.module.mail.templates.MgnlEmail.setFrom(String).  If you call 
> e.g. setFrom("Felix Rabe <felix.r...@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:
> {code}
>     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());
>         }
>     }
> {code}
> and remove the wrong pattern altogether.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to