Example usage for org.json.simple.parser ParseException printStackTrace

List of usage examples for org.json.simple.parser ParseException printStackTrace

Introduction

In this page you can find the example usage for org.json.simple.parser ParseException printStackTrace.

Prototype

public void printStackTrace(PrintStream s) 

Source Link

Document

Prints this throwable and its backtrace to the specified print stream.

Usage

From source file:kjscompiler.Program.java

/**
 * @param args/*from w w w. ja v a  2s.  com*/
 *            the command line arguments
 */
public static void main(String[] args) {

    ArgScanner as = new ArgScanner(args);

    if (as.checkValue(settingsArgName)) {
        settingsPath = as.getValue(settingsArgName);
    }

    if (as.checkValue(debugArgName)) {
        isDebug = true;
    }

    try {
        run();
    } catch (ParseException ex) {

        System.out.println("Parse Exception: " + ex.getMessage());

        if (isDebug) {
            ex.printStackTrace(new PrintStream(System.out));
        }

        System.exit(-1);
    } catch (IOException ex) {
        System.out.println("IO Exception: " + ex.getMessage());

        if (isDebug) {
            ex.printStackTrace(new PrintStream(System.out));
        }

        System.exit(-2);
    } catch (NullPointerException ex) {
        System.out.println("NullPointer Exception: " + ex.getMessage());

        if (isDebug) {
            ex.printStackTrace(new PrintStream(System.out));
        }

        System.exit(-3);
    } catch (Exception ex) {
        System.out.println("Exception: " + ex.getMessage());

        if (isDebug) {
            ex.printStackTrace(new PrintStream(System.out));
        }

        System.exit(-100);
    }

    System.exit(1);
}