jnan77 / jsonrpc4j

Automatically exported from code.google.com/p/jsonrpc4j
0 stars 0 forks source link

readResponse throws ClassCastException when trying to cast NullNode as ObjectNode #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Call readResponse

What is the expected output? What do you see instead?
I expected a response, instead I receive a ClassCastException

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

Please provide any additional information below.

This error occurs in the readResponse, specifically, this section:

// detect errors
        if (jsonObject.has("error") && jsonObject.get("error")!=null) {
            ObjectNode errorObject = ObjectNode.class.cast(jsonObject.get("error"));

The object returned by jsonObject.get("error") is a NullNode, and is not null. 
It seems like this should additionally check "&& 
!jsonObject.get("error").isNull".

Original issue reported on code.google.com by chrisr...@gmail.com on 7 Oct 2011 at 3:08

GoogleCodeExporter commented 8 years ago
Here is the JSON being parsed, if that helps:

{"result":{"version":40000,"balance":0.0,"blocks":38672,"connections":8,"proxy":
"","generate":false,"genproclimit":-1,"difficulty":140.35773446,"hashespersec":0
,"testnet":true,"keypoololdest":1317994594,"keypoolsize":101,"paytxfee":0.0,"err
ors":""},"error":null,"id":"getinfo"}

Original comment by chrisr...@gmail.com on 7 Oct 2011 at 5:11

GoogleCodeExporter commented 8 years ago
thanks, i'll look into it today.

Original comment by br...@shopnation.com on 28 Oct 2011 at 2:28

GoogleCodeExporter commented 8 years ago
Fixed and will be included in the next release

Thanks.

Original comment by brian.di...@gmail.com on 18 Nov 2011 at 6:43

GoogleCodeExporter commented 8 years ago

Original comment by brian.di...@gmail.com on 25 May 2012 at 2:51

GoogleCodeExporter commented 8 years ago

Original comment by brian.di...@gmail.com on 26 May 2012 at 2:44