<commit_before>package net.sf.jaer.util;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * A thread group that implements uncaughtException to log uncaught exceptions
 */
public class LoggingThreadGroup extends ThreadGroup {

    private static Logger logger;

    public LoggingThreadGroup(String name) {
        super(name);
    }

    /**
     * Thread and Throwable passed in here are passed to a Logger named
     * "UncaughtExceptionLogger" which has the handler LoggingWindowHandler.
     */
    public void uncaughtException(Thread thread, Throwable throwable) {
        // Initialize logger once
        if (logger == null) {
            logger = Logger.getLogger("UncaughtExceptionLogger");
            Handler handler = LoggingWindowHandler.getInstance();
            logger.addHandler(handler);
        }
        try {
            logger.log(Level.WARNING, thread == null ? "(null thread supplied)" : thread.toString(), throwable == null ? "(null exception)" : throwable);
        } catch (RuntimeException rte) {
            System.out.println((thread == null ? "(null thread supplied)" : thread.toString()) + ": " + (throwable == null ? "(null exception)" : throwable.toString()));
            if (throwable != null) {
                throwable.printStackTrace();
                if (throwable.getCause() != null) {
                    throwable.getCause().printStackTrace();
                }
            }
        }
        StringWriter sw = new StringWriter();<commit_msg>added javadoc for pararms<commit_after>package net.sf.jaer.util;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * A thread group that implements uncaughtException to log uncaught exceptions
 */
public class LoggingThreadGroup extends ThreadGroup {

    private static Logger logger;

    public LoggingThreadGroup(String name) {
        super(name);
    }

    /**
     * Thread and Throwable passed in here are passed to a Logger named
     * "UncaughtExceptionLogger" which has the handler LoggingWindowHandler.
     * 
     * @param thread the thread that threw the exception
     * @param throwable the Throwable that caused the exception
     */
    public void uncaughtException(Thread thread, Throwable throwable) {
        // Initialize logger once
        if (logger == null) {
            logger = Logger.getLogger("UncaughtExceptionLogger");
            Handler handler = LoggingWindowHandler.getInstance();
            logger.addHandler(handler);
        }
        try {
            logger.log(Level.WARNING, thread == null ? "(null thread supplied)" : thread.toString(), throwable == null ? "(null exception)" : throwable);
        } catch (RuntimeException rte) {
            System.out.println((thread == null ? "(null thread supplied)" : thread.toString()) + ": " + (throwable == null ? "(null exception)" : throwable.toString()));
            if (throwable != null) {
                throwable.printStackTrace();
                if (throwable.getCause() != null) {
                    throwable.getCause().printStackTrace();
                }
            }
        }
        StringWriter sw = new StringWriter();
{'fraction_non_alphanumeric': 0.1065989847715736, 'fraction_numerical': 0.0, 'mean_word_length': 2.5828877005347595, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '3944762', 'n_tokens_mistral': 838, 'n_tokens_neox': 818, 'n_words': 238}