protected URL createUrl()

in commons-email2-jakarta/src/main/java/org/apache/commons/mail2/jakarta/resolver/DataSourceUrlResolver.java [66:81]


    protected URL createUrl(final String resourceLocation) throws MalformedURLException {
        // if we get an non-existing base url than the resource can
        // be directly used to create an URL
        if (baseUrl == null) {
            return new URL(resourceLocation);
        }
        // if we get an non-existing location what we shall do?
        if (EmailUtils.isEmpty(resourceLocation)) {
            throw new IllegalArgumentException("No resource defined");
        }
        // if we get a stand-alone resource than ignore the base url
        if (isFileUrl(resourceLocation) || isHttpUrl(resourceLocation)) {
            return new URL(resourceLocation);
        }
        return new URL(getBaseUrl(), resourceLocation.replace("&", "&"));
    }