In my code, there is a chain of functions call where the deepest function may throw an exception. I catch and handle it according to the business logic. The problem is that all other functions in the call chain are dependent on this function, thus, if the deepest function returns null all others function will throw the NullPointerException.My question is, from the code style/maintainability/best practices point of view, can I care about the exception only at the deepest call chain level and in all higher function in the chain use something like catch (NullPointerException ignored) {}?Is it a good idea at all to use ignored in a try-catch expression or should I really address to all catches even if they are just the consequences of the execution of another function, where I do the proper exception handling?The code fragment:public static JSONObject jsonBuilder(String xmlDataSource) {    JSONObject xmlJSONObj = null;    try {        xmlJSONObj = XML.toJSONObject(xmlDataSource);    } catch (JSONException e) {        e.printStackTrace();    }    return xmlJSONObj;}public static void fetchPushData(DBDriver drv, MongoCollection<Document> dbColl, TrackedEpisode episode) {    String xmlFeed = JsonHandler.xmlDataLoader(episode.getUrlRSS());    try {        JSONObject xmlJSONObj = JsonHandler.jsonBuilder(xmlFeed);        JsonHandler.docBuilderEvent(xmlJSONObj, episode.getEpisodeID());        JSONArray itemsArr = JsonHandler.getItemsArr(xmlJSONObj);        episode.setEpisodeLastUpdate(getLatestPubDate(itemsArr));        drv.insertToDB(dbColl, itemsArr);    } catch (NullPointerException ignored) {}}Here we can see that in case of failure jsonBuilder() throws exception, which I handle and returns null. Now, the docBuilderEvent() will also throw NullPointerException due to null in xmlJSONObj. Should I care about this NullPointerException or it's enough to handle it only in the jsonBuilder()?
RSS to JSON for insertion into MongoDB
java;json;error handling;mongodb;rss