private void a(AddToBagInputEntity addtobaginputentity, JSONArray jsonarray) { JSONObject jsonobject = new JSONObject(); try { jsonobject.put("id", addtobaginputentity.getId()); jsonobject.put("ppId", addtobaginputentity.getPpId()); jsonobject.put("quantity", addtobaginputentity.getQuantity()); jsonobject.put("searchTerm", ""); } // Misplaced declaration of an exception variable catch (AddToBagInputEntity addtobaginputentity) { addtobaginputentity.printStackTrace(); } jsonarray.put(jsonobject); }