hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Volodymyr Kyrychenko (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCORE-400) ContentType.equals & hashCode are not implemented
Date Thu, 23 Apr 2015 14:04:42 GMT

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

Volodymyr Kyrychenko commented on HTTPCORE-400:

 The Content-Type header field specifies the nature of the data in the  body of an entity
by giving media type and subtype identifiers, and by providing auxiliary information that
may be required for certain media types.  After the media type and subtype names, the remainder
of the header field is simply a set of parameters, specified in an attribute=value notation.
 The ordering of parameters is ___not___ significant.

Current implementation in in violation of common java practice.
ContentType.parse("application/json")) == false

It cannot be used in collections that relies on hashCode. It cannot be used in reflection
that is not aware of particular types. It cannot be used in collections classes that relies
on equals. So in general in cannot be reliably used with any of the JRE classes. 

Current Implementation has Constants like ContentType.APPLICATION_JSON. They make no sense
since the are not equal to anything that is parsed from protocol.

ContentType.APPLICATION_JSON.equals(ContentType.create("application/json", Consts.UTF_8))
== false; !!!

Are you really saying that it is a good style and correct implementation? 

Not regarding your disagreement about attribute order current implementation violates whole
rfc. It's just compares references which has no useful meaning at all. 

> 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