code: public static URL createURL(URL base, String urlstring) throws MalformedURLException
      {
          if (urlstring.startsWith("data:"))
              return new URL(null, urlstring, new DataURLHandler());
          else
          {
              URL ret = new URL(base, urlstring);
              //fix the incorrect absolute URLs that contain ./ or ../
              String path = ret.getPath();
              if (path.startsWith("/./") || path.startsWith("/../"))
              {
                  path = path.substring(1);
                  while (path.startsWith("./") || path.startsWith("../"))
                  {
                      if (path.startsWith("./"))
                          path = path.substring(2);
                      else
                          path = path.substring(3);
                  }
                  URL fixed = new URL(base, "/" + path);
                  log.warn("Normalized non-standard URL %s to %s", ret.toString(), fixed.toString());
                  ret = fixed;
              }
              return ret;
          }
      }
docs: Creates an URL from string while considering the data: scheme.
  @param base the base URL used for relative URLs
  @param urlstring the URL string
  @return resulting URL
  @throws MalformedURLException