class UrlValidator {

    public static boolean isUrlValid(String url) {
        try {
            new URL(url).toURI();
            return true;
        } catch (MalformedURLException e) {
            throw new InvalidURLException(ErrorMessage.MALFORMED_URL);
        } catch (URISyntaxException e) {
            throw new InvalidURLException(ErrorMessage.INVALID_URI);
        }
    }

}