I have so many catch
blocks after every try to catch different type of exception occurring under it.
Is there a way I can handle all these exception in one block instead of adding a new block for every exception?
... } catch (UnknownHostException e) {
Log.e(LOG_TAG_EXCEPTION, e.getMessage());
} catch (NullPointerException e) {
Log.e(LOG_TAG_EXCEPTION, e.getMessage());
} catch (ClientProtocolException e) {
Log.e(LOG_TAG_EXCEPTION, e.getMessage());
} catch (IllegalArgumentException e) {
Log.e(LOG_TAG_EXCEPTION, e.getMessage());
} catch (URISyntaxException e) {
Log.e(LOG_TAG_EXCEPTION, e.getMessage());
} catch (MalformedURLException e) {
Log.e(LOG_TAG_EXCEPTION, e.getMessage());
} catch (IOException e) {
Log.e(LOG_TAG_EXCEPTION, e.getMessage());
} finally{…}