Example usage for java.lang UnknownError UnknownError

List of usage examples for java.lang UnknownError UnknownError

Introduction

In this page you can find the example usage for java.lang UnknownError UnknownError.

Prototype

public UnknownError(String s) 

Source Link

Document

Constructs an UnknownError with the specified detail message.

Usage

From source file:org.pantsbuild.tools.junit.impl.ConsoleRunnerImpl.java

/**
 * Returns a thread that records a system exit to the listener, and then halts(1).
 *///  ww  w  .java 2 s  . c om
private Thread createAbnormalExitHook(final AbortableListener listener, final PrintStream out) {
    Thread abnormalExitHook = new Thread() {
        @Override
        public void run() {
            try {
                listener.abort(new UnknownError("Abnormal VM exit - test crashed."));
                // We want to trap and log no matter why abort failed for a better end user message.
                // SUPPRESS CHECKSTYLE RegexpSinglelineJava
            } catch (Exception e) {
                out.println(e);
                e.printStackTrace(out);
            }
            // This error might be a call to `System.exit(0)`, which we definitely do
            // not want to go unnoticed.
            out.println("FATAL: VM exiting uncleanly.");
            out.flush();
            Runtime.getRuntime().halt(1);
        }
    };
    return abnormalExitHook;
}

From source file:ch.unibas.charmmtools.gui.step1.mdAssistant.CHARMM_GUI_InputAssistant.java

/**
 * Handles the event when one of the 3 button_open_XXX is pressed button_generate is enabled only when the 3 files
 * have been loaded/*  w ww  . jav  a 2 s.c om*/
 *
 * @param event
 */
@FXML
protected void OpenButtonPressed(ActionEvent event) {

    Window myParent = button_generate.getScene().getWindow();
    FileChooser chooser = new FileChooser();
    chooser.setInitialDirectory(new File("."));
    File selectedFile = null;

    chooser.setTitle("Open File");

    if (event.getSource().equals(button_open_PAR)) {
        chooser.getExtensionFilters().add(
                new FileChooser.ExtensionFilter("CHARMM FF parameters file (*.par,*.prm)", "*.par", "*.prm"));
        selectedFile = chooser.showOpenDialog(myParent);
        if (selectedFile != null) {
            textfield_PAR.setText(selectedFile.getAbsolutePath());
            PAR_selected = true;
        }
    } else if (event.getSource().equals(button_open_RTF)) {
        chooser.getExtensionFilters().add(
                new FileChooser.ExtensionFilter("CHARMM FF topology file (*.top,*.rtf)", "*.top", "*.rtf"));
        selectedFile = chooser.showOpenDialog(myParent);
        if (selectedFile != null) {
            textfield_RTF.setText(selectedFile.getAbsolutePath());
            RTF_selected = true;
        }
    } else if (event.getSource().equals(button_open_COR_gas)) {
        chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Coordinates file (*.pdb)", "*.pdb"));
        selectedFile = chooser.showOpenDialog(myParent);
        if (selectedFile != null) {
            textfield_COR_gas.setText(selectedFile.getAbsolutePath());
            COR_selected_gas = true;
        }
    } else if (event.getSource().equals(button_open_COR_liquid)) {
        chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Coordinates file (*.pdb)", "*.pdb"));
        selectedFile = chooser.showOpenDialog(myParent);
        if (selectedFile != null) {
            textfield_COR_liquid.setText(selectedFile.getAbsolutePath());
            COR_selected_liquid = true;
        }
    } else if (event.getSource().equals(button_open_COR_solv)) {
        chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Coordinates file (*.pdb)", "*.pdb"));
        selectedFile = chooser.showOpenDialog(myParent);
        if (selectedFile != null) {
            textfield_COR_solv.setText(selectedFile.getAbsolutePath());
            COR_selected_solv = true;
        }
    } else if (event.getSource().equals(button_open_LPUN)) {
        chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("LPUN file", "*.lpun"));
        selectedFile = chooser.showOpenDialog(myParent);
        if (selectedFile != null) {
            textfield_LPUN.setText(selectedFile.getAbsolutePath());
            LPUN_selected = true;
        }
    } else {
        throw new UnknownError("Unknown Event in OpenButtonPressed(ActionEvent event)");
    }

    this.validateButtonGenerate();

}