code: private URL getCleanedUrl(URL originalUrl,
              String originalPath) {
          try {
              return new URL(StringUtils.cleanPath(originalPath));
          } catch (MalformedURLException ex) {
              // Cleaned URL path cannot be converted to URL
              // -> take original URL.
              return originalUrl;
          }
      }
docs: Determine a cleaned URL for the given original URL.
  @param originalUrl the original URL
  @param originalPath the original URL path
  @return the cleaned URL