PriyaranjanMohapatra / rest-client

Automatically exported from code.google.com/p/rest-client
Apache License 2.0
0 stars 0 forks source link

java.lang.IllegalArgumentException: Null charset name when servers returns a 200 #120

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Send a HTTP PUT to an application server
2. Return the following response:
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Content-Length: 0
    Date: Thu, 30 Sep 2010 11:29:02 GMT
    Connection: keep-alive
3. Rest client shows the following error dialog:

Null charset name
java.lang.IllegalArgumentException: Null charset name
    at java.nio.charset.Charset.lookup(Charset.java:429)
    at java.nio.charset.Charset.forName(Charset.java:502)
    at org.wiztools.restclient.HTTPClientRequestExecuter.execute(HTTPClientRequestExecuter.java:314)
    at org.wiztools.restclient.ui.RESTView$25.run(RESTView.java:1007)

What is the expected output? What do you see instead?
See error dialog instead of no error

What version of the product are you using? On what operating system?
2.3.2

Please provide any additional information below.

Only tested on MAC.

Problem could be solved by adding an additional check to 
HTTPClientRequestExecuter.java (306)

                if(entity.getContentEncoding() != null && entity.getContentEncoding().getValue() != null){
                    charset = Charset.forName(entity.getContentEncoding().getValue());
                }

instead of:

                if(entity.getContentEncoding() != null){
                    charset = Charset.forName(entity.getContentEncoding().getValue());
                }

Original issue reported on code.google.com by rin...@gmail.com on 30 Sep 2010 at 11:40

GoogleCodeExporter commented 8 years ago
Sorry, I've just seen that this has been fixed in the 2.3 branch by catching 
the Exception and setting the default charset.

Original comment by rin...@gmail.com on 30 Sep 2010 at 1:00

GoogleCodeExporter commented 8 years ago
Thanks Ruben :-) You may try the snapshot build fixing this issue:

http://dl.dropbox.com/u/2505020/restclient-ui-2.3.3-SNAPSHOT-jar-with-dependenci
es.jar

Original comment by subwiz on 1 Oct 2010 at 6:11