void (@NotNull File settingsXml, @NotNull Map<String, RemoteRepositoryAuthentication> output) { Element settingsXmlRoot; try { settingsXmlRoot = JDOMUtil.load(settingsXml); } catch (JDOMException | IOException e) { return; } Optional<Namespace> maybeNamespace = KNOWN_NAMESPACES.stream() .filter(it -> settingsXmlRoot.getChild("servers", it) != null) .findFirst(); if (maybeNamespace.isEmpty()) { return; } Namespace namespace = maybeNamespace.get(); Element serversElement = settingsXmlRoot.getChild("servers", namespace); for (Element serverElement : serversElement.getChildren("server", namespace)) { String id = serverElement.getChildText("id", namespace); String username = serverElement.getChildText("username", namespace); String password = serverElement.getChildText("password", namespace); if (id != null && username != null && password != null) { output.put(id, new RemoteRepositoryAuthentication(username, password)); } } }