@NotNull private String findPresetHttpUrl() { return ObjectUtils.chooseNotNull( ContainerUtil.find( myUrlsFromCommand, url -> { String scheme = UriUtil.splitScheme(url).getFirst(); return scheme.startsWith("http"); }), ContainerUtil.getFirstItem(myUrlsFromCommand)); }
/** * Makes the password database key for the URL: inserts the login after the scheme: * http://login@url. */ @NotNull private static String makeKey(@NotNull String url, @Nullable String login) { if (login == null) { return url; } Couple<String> pair = UriUtil.splitScheme(url); String scheme = pair.getFirst(); if (!StringUtil.isEmpty(scheme)) { return scheme + URLUtil.SCHEME_SEPARATOR + login + "@" + pair.getSecond(); } return login + "@" + url; }