<commit_before>package de.elydon.fragments.core;

/**
 * <p>
 * Main class of fragments. Starts the {@link Application}.
 * </p>
 * <p>
 * You have to specify the fully qualified class name of the class that
 * implements {@link Application} as the first and single argument. The main
 * class instantiates an object (it needs a parameter-less constructor) of the
 * application and calls {@link Application#setup() setup}. The application
 * class must be part of the class path.
 * </p>
 * <p>
 * The setup method sets up the whole environment. It is implementation
 * dependent how the various components get assembled to a whole fragments
 * system, but usually it is needed to configure the class path in a way the JVM
 * finds all necessary classes. Please refer to the implementation of the
 * application class for more detailed information.
 * </p>
 * 
 * @author elydon
 *
 */
public class Main {

	public static void main(final String[] args) {
		if (args.length < 1) {
			System.out.println("Please specify the application class name as first argument.");
			System.exit(0);
		}
		
		final String applicationClassName = args[0];
		try {
			final Class<?> applicationClass = Class.forName(applicationClassName);
			if (!Application.class.isAssignableFrom(applicationClass)) {
				System.out.println(applicationClassName + " does not implement " + Application.class.getCanonicalName());
				System.exit(0);
			}
			
			final Application application = (Application) applicationClass.newInstance();
			final Thread applicationThread = application.setup();
			
			if (!applicationThread.isAlive()) {
				applicationThread.start();
			}
			applicationThread.join();<commit_msg>Main class throws an IllegalStateException, is Application.setup() returns null<commit_after>package de.elydon.fragments.core;

/**
 * <p>
 * Main class of fragments. Starts the {@link Application}.
 * </p>
 * <p>
 * You have to specify the fully qualified class name of the class that
 * implements {@link Application} as the first and single argument. The main
 * class instantiates an object (it needs a parameter-less constructor) of the
 * application and calls {@link Application#setup() setup}. The application
 * class must be part of the class path.
 * </p>
 * <p>
 * The setup method sets up the whole environment. It is implementation
 * dependent how the various components get assembled to a whole fragments
 * system, but usually it is needed to configure the class path in a way the JVM
 * finds all necessary classes. Please refer to the implementation of the
 * application class for more detailed information.
 * </p>
 * 
 * @author elydon
 *
 */
public class Main {

	public static void main(final String[] args) {
		if (args.length < 1) {
			System.out.println("Please specify the application class name as first argument.");
			System.exit(0);
		}
		
		final String applicationClassName = args[0];
		try {
			final Class<?> applicationClass = Class.forName(applicationClassName);
			if (!Application.class.isAssignableFrom(applicationClass)) {
				System.out.println(applicationClassName + " does not implement " + Application.class.getCanonicalName());
				System.exit(0);
			}
			
			final Application application = (Application) applicationClass.newInstance();
			final Thread applicationThread = application.setup();
			if (applicationThread == null) {
				throw new IllegalStateException("Thread of the application is null");
			}
			
			if (!applicationThread.isAlive()) {
				applicationThread.start();
			}
			applicationThread.join();
{'fraction_non_alphanumeric': 0.09613758105441218, 'fraction_numerical': 0.002255427121511136, 'mean_word_length': 4.025495750708215, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, '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': '3871380', 'n_tokens_mistral': 990, 'n_tokens_neox': 892, 'n_words': 370}