I'm using a loop to parse a JSONarray.
Suppose, i have 1000 iterations and each of contains a 5 checks:
try {
val = e.getString("x");
if (!val.equals("null")) //server response, when no data
tmp.x = Double.valueOf(val);
else
tmp.x = 0;
} catch (Exception e1) {
tmp.x = 0;
}
Most of the time catch will not be called, so the question here is to make value checks better (e.g. ==null
, isEmpty()
, etc...) and remove try-catch, or its fine now?