package org.apereo.cas.support.saml;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.opensaml.saml.metadata.resolver.impl.DOMMetadataResolver;
import org.springframework.core.io.Resource;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * This is {@link InMemoryResourceMetadataResolver}.
 *
 * @author Misagh Moayyed
 * @since 5.2.0
 */
@Slf4j
public class InMemoryResourceMetadataResolver extends DOMMetadataResolver {

    public InMemoryResourceMetadataResolver(final Resource metadataResource, final OpenSamlConfigBean configBean) throws IOException {
        super(getMetadataRootElement(metadataResource.getInputStream(), configBean));
    }

    public InMemoryResourceMetadataResolver(final InputStream metadataResource, final OpenSamlConfigBean configBean) {
        super(getMetadataRootElement(metadataResource, configBean));
    }

    public InMemoryResourceMetadataResolver(final File metadataResource, final OpenSamlConfigBean configBean) throws IOException {
        super(getMetadataRootElement(new FileInputStream(metadataResource), configBean));
    }

    @SneakyThrows
    private static Element getMetadataRootElement(final InputStream metadataResource, final OpenSamlConfigBean configBean) {
        final Document document = configBean.getParserPool().parse(metadataResource);
        return document.getDocumentElement();
    }
}

@@ -290,40 +290,8 @@
 le;%0A
-import java.io.FileInputStream;%0A
 impo
@@ -341,16 +341,44 @@
 tStream;
+%0Aimport java.nio.file.Files;
 %0A%0A/**%0A *
@@ -1156,16 +1156,17 @@
 ent(
-new 
 File
+s.new
 Inpu
@@ -1189,16 +1189,25 @@
 Resource
+.toPath()
 ), confi

fix findbugs issue