Invert conditional:

if (!(m instanceof ApplicationDataMessage) {
  return false;
}
JSONObject o...
...
return true;