android - JSONObject put method in try block causing error but catch block not executed -
android - JSONObject put method in try block causing error but catch block not executed -
this issue driving me little crazy 1 of fine people point me in right direction. attempting prepare jsonobject passed client server. next problematic method stripped downwards essentials:
private jsonobject getjsonparam(int id) { jsonobject param = new jsonobject(); seek { param.put("functioncode", 50); param.put("id", id); homecoming param; } grab (jsonexception e) { e.printstacktrace(); } grab (throwable e) { e.printstacktrace(); } homecoming null; }
i have traced code in debug mode. in actual method, set many more paramters in jsonobject , until lastly param.put() method effort insert id. when current execution line, can visualize param variable , looks good. when perform step function execute lastly param.put call, jumps homecoming null statement. have set breakpoints in both grab blocks , neither beingness executed seems. (i added sec grab block create sure no other throwable causing issues).
any ideas causing odd behavior? tried rearranging order of set calls. not have issue particular set call, lastly 1 before homecoming statement.
i working in android/java.
the code not causing error - simply beingness caught out fact compiler has optimized both homecoming statements utilize same code.
in each case homecoming of "current value", in 1 case current value comes param variable, in other case null. since compiler uses 1 re-create of code, debugger unable determine correctly actual line of source beingness executed.
android json
Comments
Post a Comment