I guess this indicates a bug in your code (since you never get docType values from the outside). Maybe just assert(false) or throw an InvalidArgumentException. A JSONException is not the right thing here.