try { URL url = new URL(str); } catch (MalformedURLException e) { DisplayErrorMessage(); }