From 6af8f50b3fd6e23094c9fbc8a01113171359948f Mon Sep 17 00:00:00 2001 From: Ali Sharif Date: Fri, 15 Jun 2018 18:33:43 -0400 Subject: [PATCH] json-rpc regression: everywhere .opt( is used, do additional check for JSONObject.NULL --- .../org/aion/api/server/http/ApiWeb3Aion.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modApiServer/src/org/aion/api/server/http/ApiWeb3Aion.java b/modApiServer/src/org/aion/api/server/http/ApiWeb3Aion.java index f6e07f4d26..f6dc86c69f 100644 --- a/modApiServer/src/org/aion/api/server/http/ApiWeb3Aion.java +++ b/modApiServer/src/org/aion/api/server/http/ApiWeb3Aion.java @@ -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")) { @@ -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; @@ -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")) { @@ -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")) { @@ -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); @@ -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)); @@ -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(); @@ -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);