hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zefi (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HTTPCORE-324) EntityUtils does not provide default charset when charset name provided is null
Date Wed, 26 Dec 2012 08:56:12 GMT

     [ https://issues.apache.org/jira/browse/HTTPCORE-324?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Zefi updated HTTPCORE-324:
--------------------------

    Description: 
Javadoc for EntityUtils.toString(HttpEntity, String) says "If defaultCharset is null, the
default "ISO-8859-1" is used", but it actually throws IllegalArgumentException.

Here's a test case to prove this:

@Test
public void shouldNotFailWhenNullCharsetStringIsGiven() throws Exception {
    try {
        EntityUtils.toString(Mockito.mock(HttpEntity.class), (String) null);
    } catch (IllegalArgumentException ex) {
        if (ex.getMessage().equals("Null charset name")) {
            throw new AssertionError("Should supply null charset with default");
        }
    }
}

  was:
Javadoc for EntityUtils.toString(HttpEntity, String) says "If defaultCharset is null, the
default "ISO-8859-1" is used", but it actually throws IllegalArgumentException.

Here's a test case to prove this:
    @Test
    public void shouldNotFailWhenNullCharsetStringIsGiven() throws Exception {
        try {
            EntityUtils.toString(Mockito.mock(HttpEntity.class), (String) null);
        } catch (IllegalArgumentException ex) {
            if (ex.getMessage().equals("Null charset name")) {
                throw new AssertionError("Should supply null charset with default");
            }
        }
    }

    
> EntityUtils does not provide default charset when charset name provided is null
> -------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-324
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-324
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>    Affects Versions: 4.2.3
>            Reporter: Zefi
>            Priority: Minor
>
> Javadoc for EntityUtils.toString(HttpEntity, String) says "If defaultCharset is null,
the default "ISO-8859-1" is used", but it actually throws IllegalArgumentException.
> Here's a test case to prove this:
> @Test
> public void shouldNotFailWhenNullCharsetStringIsGiven() throws Exception {
>     try {
>         EntityUtils.toString(Mockito.mock(HttpEntity.class), (String) null);
>     } catch (IllegalArgumentException ex) {
>         if (ex.getMessage().equals("Null charset name")) {
>             throw new AssertionError("Should supply null charset with default");
>         }
>     }
> }

--
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


Mime
View raw message