/** Adds the given URL to the given sitemap while showing the relevant logs */ private void addUrlIntoSitemap( String urlStr, SiteMap siteMap, String lastMod, String changeFreq, String priority, int urlIndex) { try { URL url = new URL(urlStr); // Checking the URL boolean valid = urlIsValid(siteMap.getBaseUrl(), url.toString()); if (valid || !strict) { SiteMapURL sUrl = new SiteMapURL(url.toString(), lastMod, changeFreq, priority, valid); siteMap.addSiteMapUrl(sUrl); LOG.debug(" {}. {}", (urlIndex + 1), sUrl); } else { LOG.warn( "URL: {} is excluded from the sitemap as it is not a valid url = not under the base url: {}", url.toExternalForm(), siteMap.getBaseUrl()); } } catch (MalformedURLException e) { LOG.warn("Bad url: [{}]", urlStr); LOG.trace("Can't create a sitemap entry with a bad URL", e); } }