<commit_before>package com.izforge.izpack.test;

import sun.misc.URLClassPath;

import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;

/**
 * Utils methods for tests purpose
 *
 * @author <NAME>
 */
public class ClassUtils
{
    public static void unloadLastJar()
            throws NoSuchFieldException, IllegalAccessException
    {
        URLClassLoader systemClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
        Field ucpField = URLClassLoader.class.getDeclaredField("ucp");
        ucpField.setAccessible(true);
        URLClassPath ucp = (URLClassPath) ucpField.get(systemClassLoader);
        Field pathField = URLClassPath.class.getDeclaredField("path");
        pathField.setAccessible(true);
        ArrayList<URL> path = (ArrayList) pathField.get(ucp);
        path.remove(path.size() - 1);

        Field loaderField = URLClassPath.class.getDeclaredField("loaders");
        loaderField.setAccessible(true);
        ArrayList loaders = (ArrayList) loaderField.get(ucp);
        loaders.remove(loaders.size() - 1);
    }

    public static void loadJarInSystemClassLoader(File out) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, MalformedURLException
    {
        URLClassLoader systemClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
        Method declaredMethod = URLClassLoader.class.getDeclaredMethod("addURL", new Class[]{URL.class});
        declaredMethod.setAccessible(true);
        declaredMethod.invoke(systemClassLoader, out.toURI().toURL());
    }
}<commit_msg>Don't throw exception in ClassUtils<commit_after>package com.izforge.izpack.test;

import com.izforge.izpack.api.exception.IzPackException;
import sun.misc.URLClassPath;

import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;

/**
 * Utils methods for tests purpose
 *
 * @author <NAME>
 */
public class ClassUtils
{
    public static void unloadLastJar()
    {
        try
        {
            URLClassLoader systemClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
            Field ucpField = URLClassLoader.class.getDeclaredField("ucp");
            ucpField.setAccessible(true);
            URLClassPath ucp = (URLClassPath) ucpField.get(systemClassLoader);
            Field pathField = URLClassPath.class.getDeclaredField("path");
            pathField.setAccessible(true);
            ArrayList<URL> path = (ArrayList) pathField.get(ucp);
            path.remove(path.size() - 1);

            Field loaderField = URLClassPath.class.getDeclaredField("loaders");
            loaderField.setAccessible(true);
            ArrayList loaders = (ArrayList) loaderField.get(ucp);
            loaders.remove(loaders.size() - 1);
        }
        catch (Exception e)
        {
            throw new IzPackException(e);
        }
    }

    public static void loadJarInSystemClassLoader(File out)
    {
        try
        {
            URLClassLoader systemClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
            Method declaredMethod = URLClassLoader.class.getDeclaredMethod("addURL", new Class[]{URL.class});
            declaredMethod.setAccessible(true);
            declaredMethod.invoke(systemClassLoader, out.toURI().toURL());
        }
        catch (Exception e)
        {
            throw new IzPackException(e);
        }
    }
}
{'fraction_non_alphanumeric': 0.10226961990702761, 'fraction_numerical': 0.0010937927262783702, 'mean_word_length': 3.2289017341040465, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1794552', 'n_tokens_mistral': 1032, 'n_tokens_neox': 1020, 'n_words': 190}