docs: static private String resolve(String base, String rel) {
      // Short-circuit check for unspecified base or relative URI.
      if (base == null || base.isEmpty()) return rel;
      if (rel == null || rel.isEmpty()) return base;
      
      // Attempt to parse both strings as URIs.
      URI b = null;
      try {
        b = new URI(base);
      } catch (URISyntaxException IGNORE) {
        // ignore, we'll handle this later.
      }
      URI r = null;
      try {
        r = new URI(rel);
      } catch (URISyntaxException IGNORE) {
        // ignore, we'll handle this later.
      }
      
      // Both URIs parsed OK, proceed as usual.
      if (b != null && r != null) return b.resolve(r).toString();
      
      // Syntax exception in the base or relative URI, need to fudge here...
      // Is the URI being resolved absolute (or does it look like it)?
      if ((r != null && r.isAbsolute()) || rel.startsWith("http:")) return rel;
      
      // One or both of the strings didn't parse as a valid URI so URI.resolve won't help us here.
      // Just smash them together and hope for the best.
      return base + rel;
    }