<commit_before>package org.jboss.windup.util;

import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;

public class FurnaceCompositeClassLoader extends ClassLoader
{
    private final List<ClassLoader> loaders = Collections.synchronizedList(new ArrayList<ClassLoader>());

    public FurnaceCompositeClassLoader(List<ClassLoader> loaders)
    {
        this.loaders.addAll(loaders);
    }

    public FurnaceCompositeClassLoader(ClassLoader classLoader, List<ClassLoader> loaders)
    {
        super(classLoader);
        this.loaders.addAll(loaders);
    }

    @Override
    public Class<?> findClass(String name) throws ClassNotFoundException
    {
        for (ClassLoader classLoader : loaders)
        {
            try
            {
                return classLoader.loadClass(name);
            }
            catch (ClassNotFoundException notFound)
            {
                // oh well
            }
        }

        ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
        if (contextLoader != null)
        {
            return contextLoader.loadClass(name);
        }
        else
        {
            return super.findClass(name);
        }
    }

    @Override
    public URL getResource(String name)
    {
        for (ClassLoader classLoader : loaders)
        {
            URL resource = classLoader.getResource(name);
            if (resource != null)
            {
                return resource;
            }
        }

        ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
        if (contextLoader != null)
        {
            return contextLoader.getResource(name);
        }
        else
        {
            return super.getResource(name);
        }
    }

    @Override
    public Enumeration<URL> getResources(String name) throws IOException
    {
        List<URL> result = new ArrayList<>();
        for (ClassLoader classLoader : loaders)
        {
            result.addAll(Collections.list(classLoader.getResources(name)));
        }

        ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
        if (contextLoader != null)
        {
            return contextLoader.getResources(name);
        }
        else
        {
            return super.getResources(name);
        }
    }
}<commit_msg>Fixed getResources in the composite classloader.<commit_after>package org.jboss.windup.util;

import java.io.IOException;
import java.net.URL;
import java.util.Collections;
import java.util.Enumeration;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

public class FurnaceCompositeClassLoader extends ClassLoader
{
    private final Set<ClassLoader> loaders = new LinkedHashSet<ClassLoader>();

    public FurnaceCompositeClassLoader(List<ClassLoader> loaders)
    {
        this.loaders.addAll(loaders);
    }

    public FurnaceCompositeClassLoader(ClassLoader classLoader, List<ClassLoader> loaders)
    {
        super(classLoader);
        this.loaders.addAll(loaders);
    }

    @Override
    public Class<?> findClass(String name) throws ClassNotFoundException
    {
        for (ClassLoader classLoader : loaders)
        {
            try
            {
                return classLoader.loadClass(name);
            }
            catch (ClassNotFoundException notFound)
            {
                // oh well
            }
        }

        ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
        if (contextLoader != null)
        {
            return contextLoader.loadClass(name);
        }
        else
        {
            return super.findClass(name);
        }
    }

    @Override
    public URL getResource(String name)
    {
        for (ClassLoader classLoader : loaders)
        {
            URL resource = classLoader.getResource(name);
            if (resource != null)
            {
                return resource;
            }
        }

        ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
        if (contextLoader != null)
        {
            return contextLoader.getResource(name);
        }
        else
        {
            return super.getResource(name);
        }
    }

    @Override
    public Enumeration<URL> getResources(String name) throws IOException
    {
        Set<URL> result = new LinkedHashSet<>();
        for (ClassLoader classLoader : loaders)
        {
            result.addAll(Collections.list(classLoader.getResources(name)));
        }

        ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
        if (contextLoader != null)
        {
            result.addAll(Collections.list(contextLoader.getResources(name)));
        }
        else
        {
            result.addAll(Collections.list(super.getResources(name)));
        }
        return Collections.enumeration(result);
    }
}
{'fraction_non_alphanumeric': 0.08858228354329134, 'fraction_numerical': 0.0, 'mean_word_length': 2.011438892233594, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1892886', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1264, 'n_words': 249}