hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Viktor (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCORE-323) Uncaught UnsupportedCharsetException in org.apache.http.entity.ContentType.getOrDefault
Date Sat, 24 Nov 2012 14:02:58 GMT
Viktor created HTTPCORE-323:

             Summary: Uncaught UnsupportedCharsetException in org.apache.http.entity.ContentType.getOrDefault
                 Key: HTTPCORE-323
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-323
             Project: HttpComponents HttpCore
          Issue Type: Bug
          Components: HttpCore
    Affects Versions: 4.2.2
         Environment: Ubuntu Linux 12.10,
Sun Java 1.7.0
Linux kernel 3.5.0-19-generic i686
            Reporter: Viktor

I have an wrong instance of HttpEntity, with illegal field "charset" (Content-Type: text/html;
charset=cp-1251) in Content-Type header, and if ContentType.getOrDefault(entity) callied with
that entity - method throwing an uncaught exception:

java.nio.charset.UnsupportedCharsetException: cp-1251
	at java.nio.charset.Charset.forName(Charset.java:543)
	at org.apache.http.entity.ContentType.create(ContentType.java:180)
	at org.apache.http.entity.ContentType.create(ContentType.java:190)
	at org.apache.http.entity.ContentType.get(ContentType.java:233)
	at org.apache.http.entity.ContentType.getOrDefault(ContentType.java:249)
	at org.apache.http.util.EntityUtils.toString(EntityUtils.java:212)
	at org.apache.http.util.EntityUtils.toString(EntityUtils.java:264)
	at com.rinamika.riwl.crawler.impl.LoaderImpl.processPage(LoaderImpl.java:131)

I  suppose that it's not right behavior because method getOrDefault must be return a defaul
value if something happend.

Sorry for my English.

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

View raw message