code: private static URL stripTrailingSlash(URL url) {
          String externalForm = url.toExternalForm();
          if (externalForm.endsWith("/")) {
              externalForm = externalForm.substring(0, externalForm.length() - 1);
              try {
                  url = new URL(externalForm);
              } catch (MalformedURLException e) {
                  // will never happen.
              }
          }
          return url;
      }
docs: Returns a URL with the trailing / stripped off
  
  @param url
  @return