String (final File settingsFile, String url, String id) { try { Element mirrorParent = getElementWithRegardToNamespace(getDomRootElement(settingsFile), "mirrors", settingsListNamespaces); if (mirrorParent == null) { return url; } List<Element> mirrors = getElementsWithRegardToNamespace(mirrorParent, "mirror", settingsListNamespaces); for (Element el : mirrors) { Element mirrorOfElement = getElementWithRegardToNamespace(el, "mirrorOf", settingsListNamespaces); Element mirrorUrlElement = getElementWithRegardToNamespace(el, "url", settingsListNamespaces); if (mirrorOfElement == null) continue; if (mirrorUrlElement == null) continue; String mirrorOf = mirrorOfElement.getTextTrim(); String mirrorUrl = mirrorUrlElement.getTextTrim(); if (StringUtil.isEmptyOrSpaces(mirrorOf) || StringUtil.isEmptyOrSpaces(mirrorUrl)) { continue; } if (isMirrorApplicable(mirrorOf, url, id)) { return mirrorUrl; } } } catch (Exception ignore) { } return url; }