// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidPriorityException.java
// public class InvalidPriorityException extends RuntimeException {
// 
//     public InvalidPriorityException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidUrlException.java
// public class InvalidUrlException extends RuntimeException {
// 
//     public InvalidUrlException(Throwable cause) {
//         super(cause);
//     }
// 
// }
// 
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/WebmasterToolsException.java
// public class WebmasterToolsException extends RuntimeException {
// 
//     public WebmasterToolsException(String message, Throwable ex) {
//         super(message, ex);
//     }
// 
//     public WebmasterToolsException(String message) {
//         super(message);
//     }
// 
//     public WebmasterToolsException(Throwable cause) {
//         super(cause);
//     }
// }


import cz.jiripinkas.jsitemapgenerator.exception.InvalidPriorityException;
import cz.jiripinkas.jsitemapgenerator.exception.InvalidUrlException;
import cz.jiripinkas.jsitemapgenerator.exception.WebmasterToolsException;
import java.io.*;
import java.lang.reflect.Method;
import java.net.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.zip.GZIPOutputStream;
     * If webPageName is null, return baseUrl.
     * If webPageName is not null, check if webPageName is absolute (can be URL from CDN) or relative URL.
     * If it's relative URL, prepend baseUrl and return result
     *
     * @param webPageName WebPageName
     * @param escapeSpecialCharacters Escape special characters?
     *                                Special characters must be escaped if the URL will be stored to sitemap.
     *                                If this method is called for ping Google / Bing functionality, special characters must not be escaped.
     * @return Correct URL
     */
    protected String getAbsoluteUrl(String webPageName, boolean escapeSpecialCharacters) {
        if(escapeSpecialCharacters) {
            webPageName = UrlUtil.escapeXmlSpecialCharacters(webPageName);
        }
        try {
            String resultString;
            if (webPageName != null) {
                URI uri = new URI(webPageName);
                String stringUrl;
                if (uri.isAbsolute()) {
                    stringUrl = webPageName;
                } else {
                    stringUrl = UrlUtil.connectUrlParts(baseUrl, webPageName);
                }
                resultString = stringUrl;
            } else {
                resultString = baseUrl;
            }
            return new URL(resultString).toString();
        } catch (MalformedURLException | URISyntaxException e) {
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidPriorityException.java
// public class InvalidPriorityException extends RuntimeException {
// 
//     public InvalidPriorityException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidUrlException.java
// public class InvalidUrlException extends RuntimeException {
// 
//     public InvalidUrlException(Throwable cause) {
//         super(cause);
//     }
// 
// }
// 
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/WebmasterToolsException.java
// public class WebmasterToolsException extends RuntimeException {
// 
//     public WebmasterToolsException(String message, Throwable ex) {
//         super(message, ex);
//     }
// 
//     public WebmasterToolsException(String message) {
//         super(message);
//     }
// 
//     public WebmasterToolsException(Throwable cause) {
//         super(cause);
//     }
// }


// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractSitemapGenerator.java
import cz.jiripinkas.jsitemapgenerator.exception.InvalidPriorityException;
import cz.jiripinkas.jsitemapgenerator.exception.InvalidUrlException;
import cz.jiripinkas.jsitemapgenerator.exception.WebmasterToolsException;
import java.io.*;
import java.lang.reflect.Method;
import java.net.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.zip.GZIPOutputStream;

     * If webPageName is null, return baseUrl.
     * If webPageName is not null, check if webPageName is absolute (can be URL from CDN) or relative URL.
     * If it's relative URL, prepend baseUrl and return result
     *
     * @param webPageName WebPageName
     * @param escapeSpecialCharacters Escape special characters?
     *                                Special characters must be escaped if the URL will be stored to sitemap.
     *                                If this method is called for ping Google / Bing functionality, special characters must not be escaped.
     * @return Correct URL
     */
    protected String getAbsoluteUrl(String webPageName, boolean escapeSpecialCharacters) {
        if(escapeSpecialCharacters) {
            webPageName = UrlUtil.escapeXmlSpecialCharacters(webPageName);
        }
        try {
            String resultString;
            if (webPageName != null) {
                URI uri = new URI(webPageName);
                String stringUrl;
                if (uri.isAbsolute()) {
                    stringUrl = webPageName;
                } else {
                    stringUrl = UrlUtil.connectUrlParts(baseUrl, webPageName);
                }
                resultString = stringUrl;
            } else {
                resultString = baseUrl;
            }
            return new URL(resultString).toString();
        } catch (MalformedURLException | URISyntaxException e) {
            throw new InvalidUrlException(e);