<commit_before>package omnikryptec.logger;

import java.util.concurrent.TimeUnit;
import omnikryptec.debug.SignalAwaiter;
import omnikryptec.logger.LogEntry.LogLevel;
import omnikryptec.main.OmniKryptecEngine;
import omnikryptec.main.OmniKryptecEngine.ShutdownOption;

/**
 *
 * @author Panzer1119
 */
public class Commands {
    
    public static final Command COMMANDEXIT = new Command("exit") {
        
        @Override
        public void run(String arguments) {
            ShutdownOption shutdownOption = ShutdownOption.JAVA;
            boolean instantShutdown = false;
            if(!arguments.isEmpty()) {
                boolean found = false;
                String[] args = getArguments(arguments);
                for(String g : args) {
                    if(g.equalsIgnoreCase("-engine")) {
                        shutdownOption = ShutdownOption.ENGINE;
                        found = true;
                    } else if(g.equalsIgnoreCase("-java")) {
                        instantShutdown = true;
                        found = true;
                    }
                }
                if(!found) {
                    Logger.log(getHelp());
                    return;
                }
            }
            try {
                if(instantShutdown) {
                    shutdownCompletely();
                } else if(OmniKryptecEngine.instance().getState() != (OmniKryptecEngine.State.Running || OmniKryptecEngine.State.Starting)) {
                    Logger.log("Engine is not running", LogLevel.WARNING);
                } else {
                    OmniKryptecEngine.instance().requestClose();
                    Logger.log("Engine was successfully exited");
                }
                if(shutdownOption == ShutdownOption.JAVA) {
                    shutdownCompletely();
                }
            } catch (Exception ex) {
                if(shutdownOption == ShutdownOption.JAVA) {
                    shutdownCompletely();
                } else {
                    if(ex instanceof NullPointerException) {
                        Logger.log("No engine existing", LogLevel.WARNING);
                    } else {
                        Logger.logErr("Error while shutting down the engine: " + ex, ex);
                    }
                }
            }
        }
        
    }.setUseArguments(true).setHasExtraThread(true).setHelp("Usage:\nexit [-engine/-java]\nParameter - Description\nengine - Stops only the engine\njava - Stops directly the JVM");
    
    public static final Command COMMANDTEST = new Command("test") {
        
        @Override
        public void run(String arguments) {
            try {
                String[] args = getArguments(arguments);
                for(String arg : args) {
                    Logger.log(arg);
                }
            } catch (Exception ex) {<commit_msg>Hotfix for the bugfix before<commit_after>package omnikryptec.logger;

import java.util.concurrent.TimeUnit;
import omnikryptec.debug.SignalAwaiter;
import omnikryptec.logger.LogEntry.LogLevel;
import omnikryptec.main.OmniKryptecEngine;
import omnikryptec.main.OmniKryptecEngine.ShutdownOption;

/**
 *
 * @author Panzer1119
 */
public class Commands {
    
    public static final Command COMMANDEXIT = new Command("exit") {
        
        @Override
        public void run(String arguments) {
            ShutdownOption shutdownOption = ShutdownOption.JAVA;
            boolean instantShutdown = false;
            if(!arguments.isEmpty()) {
                boolean found = false;
                String[] args = getArguments(arguments);
                for(String g : args) {
                    if(g.equalsIgnoreCase("-engine")) {
                        shutdownOption = ShutdownOption.ENGINE;
                        found = true;
                    } else if(g.equalsIgnoreCase("-java")) {
                        instantShutdown = true;
                        found = true;
                    }
                }
                if(!found) {
                    Logger.log(getHelp());
                    return;
                }
            }
            try {
                if(instantShutdown) {
                    shutdownCompletely();
                } else {
                    final OmniKryptecEngine.State state = OmniKryptecEngine.instance().getState();
                    if(state != OmniKryptecEngine.State.Running && state != OmniKryptecEngine.State.Starting) {
                        Logger.log("Engine is not running", LogLevel.WARNING);
                    } else {
                        OmniKryptecEngine.instance().requestClose();
                        Logger.log("Engine was successfully exited");
                    }
                }
                if(shutdownOption == ShutdownOption.JAVA) {
                    shutdownCompletely();
                }
            } catch (Exception ex) {
                if(shutdownOption == ShutdownOption.JAVA) {
                    shutdownCompletely();
                } else {
                    if(ex instanceof NullPointerException) {
                        Logger.log("No engine existing", LogLevel.WARNING);
                    } else {
                        Logger.logErr("Error while shutting down the engine: " + ex, ex);
                    }
                }
            }
        }
        
    }.setUseArguments(true).setHasExtraThread(true).setHelp("Usage:\nexit [-engine/-java]\nParameter - Description\nengine - Stops only the engine\njava - Stops directly the JVM");
    
    public static final Command COMMANDTEST = new Command("test") {
        
        @Override
        public void run(String arguments) {
            try {
                String[] args = getArguments(arguments);
                for(String arg : args) {
                    Logger.log(arg);
                }
            } catch (Exception ex) {
{'fraction_non_alphanumeric': 0.09134045077105575, 'fraction_numerical': 0.0013557024233180816, 'mean_word_length': 1.3865750101091792, 'pattern_counts': {'":': 0, '<': 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': '2632015', 'n_tokens_mistral': 1514, 'n_tokens_neox': 1383, 'n_words': 283}