You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Arūnas Bendoraitis (JIRA)" <ji...@apache.org> on 2013/05/14 19:47:17 UTC
[jira] [Updated] (HTTPCORE-339) org.apache.http.entity.ContentType
contructor should check empty charsets.
[ https://issues.apache.org/jira/browse/HTTPCORE-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Arūnas Bendoraitis updated HTTPCORE-339:
----------------------------------------
Description:
ContentType(
final String mimeType,
final NameValuePair[] params) throws UnsupportedCharsetException {
this.mimeType = mimeType;
this.params = params;
final String s = getParameter("charset");
this.charset = s != null ? Charset.forName(s) : null;
}
It only checks for null, but should check for empty as well.
Last line should be replaced with:
this.charset = !TextUtils.isBlank(s) ? Charset.forName(s) : null;
In create method as far as I remember there was the same bug earlier, but now it's fixed and is like this:
public static ContentType create(
final String mimeType, final String charset) throws UnsupportedCharsetException {
return create(mimeType, !TextUtils.isBlank(charset) ? Charset.forName(charset) : null);
}
Some hosts may have empty string in the charset and then IllegalArgumentException happens in Charset.forName(..).
was:
ContentType(
final String mimeType,
final NameValuePair[] params) throws UnsupportedCharsetException {
this.mimeType = mimeType;
this.params = params;
final String s = getParameter("charset");
this.charset = s != null ? Charset.forName(s) : null;
}
It only checks for null, but should check for empty as well.
Last line should be replaced with:
this.charset = !TextUtils.isBlank(charset) ? Charset.forName(s) : null;
In create method as far as I remember there was the same bug earlier, but now it's fixed and is like this:
public static ContentType create(
final String mimeType, final String charset) throws UnsupportedCharsetException {
return create(mimeType, !TextUtils.isBlank(charset) ? Charset.forName(charset) : null);
}
Some hosts may have empty string in the charset and then IllegalArgumentException happens in Charset.forName(..).
> org.apache.http.entity.ContentType contructor should check empty charsets.
> --------------------------------------------------------------------------
>
> Key: HTTPCORE-339
> URL: https://issues.apache.org/jira/browse/HTTPCORE-339
> Project: HttpComponents HttpCore
> Issue Type: Bug
> Reporter: Arūnas Bendoraitis
>
> ContentType(
> final String mimeType,
> final NameValuePair[] params) throws UnsupportedCharsetException {
> this.mimeType = mimeType;
> this.params = params;
> final String s = getParameter("charset");
> this.charset = s != null ? Charset.forName(s) : null;
> }
> It only checks for null, but should check for empty as well.
> Last line should be replaced with:
> this.charset = !TextUtils.isBlank(s) ? Charset.forName(s) : null;
> In create method as far as I remember there was the same bug earlier, but now it's fixed and is like this:
> public static ContentType create(
> final String mimeType, final String charset) throws UnsupportedCharsetException {
> return create(mimeType, !TextUtils.isBlank(charset) ? Charset.forName(charset) : null);
> }
> Some hosts may have empty string in the charset and then IllegalArgumentException happens in Charset.forName(..).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org