Actually endpoint is URL. IllegalArgumentException can appear while creating URI for http methods : URI.create(endpoint). but never mind, it's better to catch 'Exception' and debug 'endpoint' + 'query'.