hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Osipov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCORE-400) ContentType.equals & hashCode are not implemented
Date Fri, 24 Apr 2015 18:51:39 GMT

    [ https://issues.apache.org/jira/browse/HTTPCORE-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14511531#comment-14511531

Michael Osipov commented on HTTPCORE-400:

While following this discussion, I am inclided to agree with Oleg, for at least three reasons:

1. The Mono implementation is stupid. It compares on the toString representation which is
plain wrong, as far as i can see. Given that qualifiers are order-insensitive, there will
be not equal, although they are: {{bla=bar; blub=bar}} and  {{blub=bar; bla=bar}}.
2. JAX-RS' is a bit better by comparing real fields and not strings
3. JAX-RS uses toLowerCase in hasCode without Locale.ROOT. We all know that this is a problem

but still, the very meaning of {{Content-Type}} is only known to the server and and its consumer.
The transporting lib has no knowledge about. At best, {{ContentType}} could compare type and
subtype. Not speaking of hash code at all.

Why not extend ContentType by passing a optional comparator to the constructor? This could
the set in HttpClientBuilder and passed to HttpCore. Consumer would be in control of comparsion.
Of course a HashCodeBuilder would be necessary too.

> ContentType.equals & hashCode are not implemented
> -------------------------------------------------
>                 Key: HTTPCORE-400
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-400
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>            Reporter: Volodymyr Kyrychenko
> Since equals and hashCode are not implemented it's impossible to use them in handful
of cases

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message