code: private static String getTrimmedPath(String path) {
          String result = path;
          if (result.endsWith("/")) {
              result = result.substring(0, result.length() - 1);
          }
          return result;
      }
docs: a slash and those that don't.