code: public static void checkUri(String uri, String message, Object... args) {
      try {
        new URI(uri);
      } catch (URISyntaxException e) {
        throw new IllegalArgumentException(String.format(message, args), e);
      }
    }
docs: Validates that an argument is a valid URI.
  
  @param uri The value to check.
  @param message An exception message.
  @param args Exception message arguments.