Skip to content

Commit

Permalink
Merge pull request #529 from aionnetwork/rpc-nullfix
Browse files Browse the repository at this point in the history
json-rpc regression: JSONObject.NULL checks everywhere JSON.opt(...) is used
  • Loading branch information
qoire authored Jun 16, 2018
2 parents 84df0a7 + 6af8f50 commit ef5df39
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions modApiServer/src/org/aion/api/server/http/ApiWeb3Aion.java
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ else if (_params instanceof JSONObject) {
Address address = new Address(_address);

String bnOrId = "latest";
if (_bnOrId != null)
if (_bnOrId != null && !_bnOrId.equals(JSONObject.NULL))
bnOrId = _bnOrId + "";

if (!bnOrId.equalsIgnoreCase("latest")) {
Expand Down Expand Up @@ -448,7 +448,7 @@ else if (_params instanceof JSONObject) {
Address address = new Address(_address);

String bnOrId = "latest";
if (_bnOrId != null)
if (_bnOrId != null && !_bnOrId.equals(JSONObject.NULL))
bnOrId = _bnOrId + "";

DataWord key;
Expand Down Expand Up @@ -497,7 +497,7 @@ else if (_params instanceof JSONObject) {
Address address = new Address(_address);

String bnOrId = "latest";
if (_bnOrId != null)
if (_bnOrId != null && !_bnOrId.equals(JSONObject.NULL))
bnOrId = _bnOrId + "";

if (!bnOrId.equalsIgnoreCase("latest")) {
Expand Down Expand Up @@ -584,7 +584,7 @@ else if (_params instanceof JSONObject) {
Address address = new Address(_address);

String bnOrId = "latest";
if (_bnOrId != null)
if (_bnOrId != null && !_bnOrId.equals(JSONObject.NULL))
bnOrId = _bnOrId + "";

if (!bnOrId.equalsIgnoreCase("latest")) {
Expand Down Expand Up @@ -695,7 +695,7 @@ else if (_params instanceof JSONObject) {
ArgTxCall txParams = ArgTxCall.fromJSON(_tx, getNrgOracle(), getDefaultNrgLimit());

String bnOrId = "latest";
if (_bnOrId != null)
if (_bnOrId != null && !_bnOrId.equals(JSONObject.NULL))
bnOrId = _bnOrId + "";

Long bn = parseBnOrId(bnOrId);
Expand Down Expand Up @@ -1149,7 +1149,7 @@ else if (_params instanceof JSONObject) {


int duration = 300;
if (_duration != null)
if (_duration != null && !_duration.equals(JSONObject.NULL))
duration = new BigInteger(_duration + "").intValueExact();

return new RpcMsg(unlockAccount(_account, _password, duration));
Expand Down Expand Up @@ -2249,7 +2249,7 @@ public RpcMsg stratum_submitblock(Object _params) {
JSONObject obj = new JSONObject();

if (nce != null && soln != null && hdrHash != null &&
!nce.equals(null) && !soln.equals(null) && !hdrHash.equals(null)) {
!nce.equals(JSONObject.NULL) && !soln.equals(JSONObject.NULL) && !hdrHash.equals(JSONObject.NULL)) {

try {
templateMapLock.writeLock().lock();
Expand Down Expand Up @@ -2300,7 +2300,7 @@ public RpcMsg stratum_getHeaderByBlockNumber(Object _params) {

JSONObject obj = new JSONObject();

if (_blockNum != null) {
if (_blockNum != null && !_blockNum.equals(JSONObject.NULL)) {
String bnStr = _blockNum + "";
try {
int bnInt = Integer.decode(bnStr);
Expand Down

0 comments on commit ef5df39

Please sign in to comment.