code: public static URI create(final String s) throws URISyntaxException {
          try {
              return new URI(encode(s));
          }
          catch (URISyntaxException use) {
              if (CompatibilityHints
                      .isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)) {
                  String encoded = encode(s);
                  int index = encoded.indexOf(':');
                  if (index != -1 && index < encoded.length() -1) {
                      try {
                          return new URI(encoded.substring(0, index), encoded.substring(index + 1), null);
                      } catch (URISyntaxException use2) {
                      }
                  }
                  try {
                      return new URI(INVALID_SCHEME, s, null);
                  } catch (URISyntaxException use2) {
                      // should not happen as we are building an opaque URI
                      throw new IllegalArgumentException("Could not build URI from " + s);
                  }
              }
              throw use;
          }
      }
docs: Attempts to create a URI instance and will optionally swallow any resulting URISyntaxException depending on
  configured {@link CompatibilityHints}. Will also automatically attempt encoding of the string representation for
  greater compatibility.
  <p>When relaxed parsing is enabled and if the string representation is not valid, a second URI creation attempt is made
  by extracting the scheme from the scheme specific part and URI encoding that later part. For example,
  "mailto: joe smith@example.com" becomes "mailto:joe%20smith@example.com".<p>
  <p>If the second attempts also leads to a {@code URISyntaxException}, an opaque URI is constructed with a scheme
  of {@code Uris.INVALID_SCHEME} and a value corresponding to the initial representation.</p>
  
  @param s a string representation of a URI.
  @return a URI instance, which may not correspond to the URI string if a valid
  URI string is not specified and relaxed parsing is enabled.
  @throws URISyntaxException if a valid URI string is not specified and relaxed parsing is disabled