jira-importer opened a new issue, #867:
URL: https://github.com/apache/httpcomponents-core/issues/867

   **[Arūnas 
Bendoraitis](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=freddy1)**
 opened 
**[HTTPCORE-339](https://issues.apache.org/jira/browse/HTTPCORE-339?redirect=false)**
 and commented
   
       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(..).
   
   
   ---
   No further details from 
[HTTPCORE-339](https://issues.apache.org/jira/browse/HTTPCORE-339?redirect=false)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to