Source:
<code>public List<JSONActivity> getActivities(Date fromDate, Date toDate, Class mambuEntity, String entityId) throws MambuApiException { if (fromDate == null) { throw new IllegalArgumentException("From Date must not be NULL"); } if (toDate == null) { throw new IllegalArgumentException("To Date must not be NULL"); } if ((mambuEntity == null && entityId != null) || (mambuEntity != null && entityId == null)) { throw new IllegalArgumentException( "Mambu Entity class and its ID must be either both NULL or both NOT NULL"); } final String dateTimeFormat = APIData.yyyyMmddFormat; ParamsMap params = new ParamsMap(); try { String formattedFromDate = new SimpleDateFormat(dateTimeFormat).format(fromDate); params.put(FROM, formattedFromDate); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Invalid From Date"); } try { String formattedToDate = new SimpleDateFormat(dateTimeFormat).format(toDate); params.put(TO, formattedToDate); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Invalid To Date"); } String idParameterName = null; if (mambuEntity != null) { <START> try { <END> idParameterName = getIdParameterName(mambuEntity); } catch (IllegalArgumentException e) { throw e; } } if (idParameterName != null) { params.put(idParameterName, entityId); } String urlString = new String(mambuAPIService.createUrl(ACTIVITIES + "/")); String activitiesResposne = mambuAPIService.executeRequest(urlString, params, Method.GET); Type collectionType = new TypeToken<List<JSONActivity>>() {}.getType(); List<JSONActivity> activities = GsonUtils.createGson().fromJson(activitiesResposne, collectionType); return activities; }</code><technical_language>If rethrowing exception logs, is need for a try{} catch{} blog</technical_language>

Target:
public List<JSONActivity> getActivities(Date fromDate, Date toDate, Class mambuEntity, String entityId) throws MambuApiException { if (fromDate == null) { throw new IllegalArgumentException("From Date must not be NULL"); } if (toDate == null) { throw new IllegalArgumentException("To Date must not be NULL"); } if ((mambuEntity == null && entityId != null) || (mambuEntity != null && entityId == null)) { throw new IllegalArgumentException( "Mambu Entity class and its ID must be either both NULL or both NOT NULL"); } final String dateTimeFormat = APIData.yyyyMmddFormat; ParamsMap params = new ParamsMap(); try { String formattedFromDate = new SimpleDateFormat(dateTimeFormat).format(fromDate); params.put(FROM, formattedFromDate); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Invalid From Date"); } try { String formattedToDate = new SimpleDateFormat(dateTimeFormat).format(toDate); params.put(TO, formattedToDate); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Invalid To Date"); } if (mambuEntity != null) { params.put(getIdParameterName(mambuEntity), entityId); } String urlString = new String(mambuAPIService.createUrl(ACTIVITIES + "/")); String activitiesResposne = mambuAPIService.executeRequest(urlString, params, Method.GET); Type collectionType = new TypeToken<List<JSONActivity>>() {}.getType(); List<JSONActivity> activities = GsonUtils.createGson().fromJson(activitiesResposne, collectionType); return activities; }