[
https://issues.apache.org/jira/browse/JAMES-2552?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Antoine Duprat updated JAMES-2552:
----------------------------------
Description:
The mail address defined in this RFC:
[https://tools.ietf.org/html/rfc5321#section-2.4] is leading to some
interpretation on the case sensitive of user part.
Case insensitiveness of domains is already embeded as part of {{Domain}} object
which MailAddress relies on.
Tests needs to be added in MailAddress tests:
{code:java}
[email protected] == [email protected] [email protected] != [email protected] {code}
{{ }}
But this commit should be dropped.
(BTW equals already do ignore case assertions...)
{code:java}
@Override
public final boolean equals(Object obj) {
if (obj == null) {
return false;
} else if (obj instanceof String) {
String theString = (String) obj;
return toString().equalsIgnoreCase(theString);
} else if (obj instanceof MailAddress) {
MailAddress addr = (MailAddress) obj;
if (isNullSender() && addr.isNullSender()) {
return true;
}
return equalsIgnoreCase(getLocalPart(), addr.getLocalPart())
&& Objects.equals(getDomain(), addr.getDomain());
}
return false;
}{code}
So I wonder how {{equalsIgnoreCase}} differs from {{equals}}. We may need a
(separate) ticket to fix this incorrect behaviour (James should support case
variation in mailAdresss - or alike)
Maybe TDD would have avoided such duplicated code BTW...
was:
The mail address defined in this RFC:
[https://tools.ietf.org/html/rfc5321#section-2.4] is leading to some
interpretation on the case sensitive of user part.
Case insensitiveness of domains is already embeded as part of {{Domain}} object
which MailAddress relies on.
Tests needs to be added in MailAddress tests:
{code:java}
[email protected] == [email protected] [email protected] != [email protected] {code}
{{ }}
But this commit should be dropped.
(BTW equals already do ignore case assertions...)
{code:java}
@Override
public final boolean equals(Object obj) {
if (obj == null) {
return false;
} else if (obj instanceof String) {
String theString = (String) obj;
return toString().equalsIgnoreCase(theString);
} else if (obj instanceof MailAddress) {
MailAddress addr = (MailAddress) obj;
if (isNullSender() && addr.isNullSender()) {
return true;
}
return equalsIgnoreCase(getLocalPart(), addr.getLocalPart())
&& Objects.equals(getDomain(), addr.getDomain());
}
return false;
}{code}
{{}}
{{}}{{}}
So I wonder how {{equalsIgnoreCase}} differs from {{equals}}. We may need a
(separate) ticket to fix this incorrect behaviour (James should support case
variation in mailAdresss - or alike)
Maybe TDD would have avoided such duplicated code BTW...
[
|https://tools.ietf.org/html/rfc5321#section-2.4]
> Define the policy on mail address matching
> ------------------------------------------
>
> Key: JAMES-2552
> URL: https://issues.apache.org/jira/browse/JAMES-2552
> Project: James Server
> Issue Type: New Feature
> Reporter: Antoine Duprat
> Priority: Major
>
> The mail address defined in this RFC:
> [https://tools.ietf.org/html/rfc5321#section-2.4] is leading to some
> interpretation on the case sensitive of user part.
> Case insensitiveness of domains is already embeded as part of {{Domain}}
> object which MailAddress relies on.
> Tests needs to be added in MailAddress tests:
> {code:java}
> [email protected] == [email protected] [email protected] != [email protected] {code}
> {{ }}
> But this commit should be dropped.
> (BTW equals already do ignore case assertions...)
> {code:java}
> @Override
> public final boolean equals(Object obj) {
> if (obj == null) {
> return false;
> } else if (obj instanceof String) {
> String theString = (String) obj;
> return toString().equalsIgnoreCase(theString);
> } else if (obj instanceof MailAddress) {
> MailAddress addr = (MailAddress) obj;
> if (isNullSender() && addr.isNullSender()) {
> return true;
> }
> return equalsIgnoreCase(getLocalPart(), addr.getLocalPart())
> && Objects.equals(getDomain(), addr.getDomain());
> }
> return false;
> }{code}
> So I wonder how {{equalsIgnoreCase}} differs from {{equals}}. We may need a
> (separate) ticket to fix this incorrect behaviour (James should support case
> variation in mailAdresss - or alike)
> Maybe TDD would have avoided such duplicated code BTW...
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]