Example usage for java.awt HeadlessException printStackTrace

List of usage examples for java.awt HeadlessException printStackTrace

Introduction

In this page you can find the example usage for java.awt HeadlessException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:playground.sergioo.capacitiesChanger2012.gui.NetworkPanel.java

public void findAddress() {
    requestFocus();/*from w w w .  j ava2s  . co  m*/
    try {
        addressLocator.locate(JOptionPane.showInputDialog("Insert the desired address") + " Singapore");
        posLocation = 0;
        if (addressLocator.getNumResults() > 1)
            JOptionPane.showMessageDialog(this, "Many results: " + addressLocator.getNumResults() + ".");
        try {
            JOptionPane.showMessageDialog(this, addressLocator.getLocation(posLocation).toString());
            Coord c = addressLocator.getLocation(posLocation);
            centerCamera(new double[] { c.getX(), c.getY() });
        } catch (HeadlessException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IllegalStateException e) {
        e.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (ParserConfigurationException e) {
        e.printStackTrace();
    } catch (SAXException e) {
        e.printStackTrace();
    } catch (BadAddressException e) {
        JOptionPane.showMessageDialog(this, "No results");
    }
}

From source file:com.projity.pm.graphic.frames.StartupFactory.java

public GraphicManager instanceFromNewSession(Container container, final boolean doWelcome) {
    VersionUtils.versionCheck(true);//from  w w  w. j  a v a2  s .c  om
    if (!VersionUtils.isJnlpUpToDate())
        System.out.println("Jnlp isn't up to date, current version is: " + VersionUtils.getJnlpVersion());
    long t = System.currentTimeMillis();
    //      System.out.println("---------- StartupFactory instanceFromNewSession#1 main");
    Environment.setClientSide(true);

    System.setSecurityManager(null);
    Thread loadConfigThread = new Thread("loadConfig") {
        public void run() {
            long t = System.currentTimeMillis();
            //            System.out.println("---------- StartupFactory instanceFromNewSession#1 doLoadConfig");
            doLoadConfig();
            //            System.out.println("---------- StartupFactory instanceFromNewSession#1 doLoadConfig done in "+(System.currentTimeMillis()-t)+" ms");
        }
    };
    loadConfigThread.start();

    GraphicManager graphicManager = null;
    //String projectUrl[]=null;
    try {
        graphicManager = new GraphicManager(/*projectUrl,*/serverUrl, container);
        graphicManager.setStartupFactory(this);
    } catch (HeadlessException e) {
        e.printStackTrace();
    }
    graphicManager.setConnected(false);

    if (!doLogin(graphicManager))
        return null;
    //if (Environment.isNewLook())
    graphicManager.initLookAndFeel();

    SessionFactory.getInstance().setJobQueue(graphicManager.getJobQueue());

    PartnerInfo partnerInfo = null;
    if (!Environment.getStandAlone()) {
        Session session = SessionFactory.getInstance().getSession(false);
        try {
            partnerInfo = (PartnerInfo) SessionFactory.call(session, "retrievePartnerInfo", null, null);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    //      System.out.println("---------- StartupFactory instanceFromNewSession#1 main done in "+(System.currentTimeMillis()-t)+" ms");
    try {
        loadConfigThread.join();
    } catch (InterruptedException e1) {
        e1.printStackTrace();
    }

    t = System.currentTimeMillis();
    //      System.out.println("---------- StartupFactory instanceFromNewSession#2");

    //graphicManager.showWaitCursor(true); //TODO use a progress bar - maybe a Job
    if (partnerInfo != null) {

        if (partnerInfo.getConfigurationXML() != null) {
            ConfigurationReader.readString(partnerInfo.getConfigurationXML(), Configuration.getInstance());
            Configuration.getInstance().setDonePopulating();
        }
        if (partnerInfo.getViewXML() != null) {
            ConfigurationReader.readString(partnerInfo.getViewXML(), Dictionary.getInstance());
        }
    }

    final GraphicManager gm = graphicManager;
    graphicManager.beginInitialization();
    try {

        graphicManager.initView();
        doStartupAction(gm, projectId,
                (projectUrls == null && gm.getLastFileName() != null) ? new String[] { gm.getLastFileName() }
                        : projectUrls,
                doWelcome, false);

        doPostInitView(gm.getContainer());

        //         final Container cc=container;
        //         SwingUtilities.invokeLater(new Runnable() {
        //
        //             @Override
        //             public void run() {
        //               //cc.setVisible(true);
        //               gm.initView();
        //               doStartupAction(gm,projectId,(projectUrls==null&&gm.getLastFileName()!=null)?new String[]{gm.getLastFileName()}:projectUrls,doWelcome,false);
        //
        //               doPostInitView(gm.getContainer());
        //             }
        //         });

    } finally {
        graphicManager.finishInitialization();
    }
    return graphicManager;
}

From source file:org.omegat.gui.scripting.ScriptingTest.java

/**
 * Test for bug #775: Unresolvable scripting folder setting can cause an empty
 * Scripting window//  ww w . j  a v a  2 s  .  c o  m
 * <p>
 * NPE while initializing quick script menu entries when the script folder path
 * member is null (failed to be set because it was invalid).
 * 
 * @see <a href="https://sourceforge.net/p/omegat/bugs/775/">Bug #775</a>
 */
public void testLoadScriptingWindow() throws Exception {
    // Set quick script
    Preferences.setPreference(Preferences.SCRIPTS_QUICK_PREFIX + 1, "blah");

    // Set bogus scripts folder (a file can't be a folder!)
    File tmp = File.createTempFile("omegat", "tmp");
    try {
        Preferences.setPreference(Preferences.SCRIPTS_DIRECTORY, tmp.getAbsolutePath());
        new ScriptingWindow();
    } catch (HeadlessException ex) {
        // Can't do this test when headless
        ex.printStackTrace();
    } finally {
        assertTrue(tmp.delete());
    }
}

From source file:pl.edu.icm.visnow.system.main.VisNow.java

private static void initJava3D() {
    LOGGER.info("Initializing Java3D... ");
    try {// w  ww  .j a  v  a 2s .  co m
        Class cl = Class.forName("javax.media.j3d.VirtualUniverse");
        VisNowJava3DInit.initJava3D(debug, LOGGER);
        persistJava3DState(true);
    } catch (HeadlessException ex) {
        LOGGER.fatal("");
        LOGGER.fatal("ERROR: cannot initialize display!");
        if (debug) {
            ex.printStackTrace();
        }
        System.exit(1);
    } catch (VisNowJava3DInit.Java3DVersionException ex) {
        boolean oldState = readJava3DPersistedState();
        LOGGER.fatal("");
        if (oldState) {
            LOGGER.fatal("ERROR: Java3D version " + ex.getVersion()
                    + " is not supported. Minimum version is 1.5.2! Please refer to VisNow documentation.\nNOTE: Please note that VisNow was already running properly with Java3D on this machine.\nThis might mean that some external changes have been made to your Java3D installation.\nTry reinstalling Java3D or rerun VisNow installer.");
            try {
                JOptionPane.showMessageDialog(null, "ERROR!\n\nJava3D version " + ex.getVersion()
                        + " is not supported.\nMinimum version is 1.5.2!\n\nPlease refer to VisNow documentation.\n\n\n\nNOTE: Please note that VisNow was already running properly with Java3D on this machine.\nThis might mean that some external changes have been made to your Java3D installation.\nTry reinstalling Java3D or rerun VisNow installer.",
                        "Java3D version error", JOptionPane.ERROR_MESSAGE);
            } catch (HeadlessException hex) {
            }
        } else {
            LOGGER.fatal("ERROR: Java3D version " + ex.getVersion()
                    + " is not supported. Minimum version is 1.5.2! Please refer to VisNow documentation.");
            try {
                JOptionPane.showMessageDialog(null, "ERROR!\n\nJava3D version " + ex.getVersion()
                        + " is not supported.\nMinimum version is 1.5.2!\n\nPlease refer to VisNow documentation.\n\n",
                        "Java3D version error", JOptionPane.ERROR_MESSAGE);
            } catch (HeadlessException hex) {
            }
        }
        System.exit(1);
    } catch (Exception ex) {
        boolean oldState = readJava3DPersistedState();
        LOGGER.fatal("");
        if (oldState) {
            LOGGER.fatal(
                    "ERROR: cannot initialize Java3D library!\nNOTE: Please note that VisNow was already running properly with Java3D on this machine.\nThis might mean that some external changes have been made to your Java3D installation.\nTry reinstalling Java3D or rerun VisNow installer.");
            try {
                JOptionPane.showMessageDialog(null,
                        "ERROR!\n\nCannot initialize Java3D library.\n\nPlease refer to VisNow documentation\nor contact your system adminstrator.\n\n\n\nNOTE: Please note that VisNow was already running properly with Java3D on this machine.\nThis might mean that some external changes have been made to your Java3D installation.\nTry reinstalling Java3D or rerun VisNow installer.",
                        "Java3D error", JOptionPane.ERROR_MESSAGE);
            } catch (HeadlessException hex) {
            }
        } else {
            LOGGER.fatal("ERROR: cannot initialize Java3D library!");
            try {
                JOptionPane.showMessageDialog(null,
                        "ERROR!\n\nCannot initialize Java3D library.\n\nPlease refer to VisNow documentation\nor contact your system adminstrator.\n\n",
                        "Java3D error", JOptionPane.ERROR_MESSAGE);
            } catch (HeadlessException hex) {
            }
        }
        if (debug) {
            ex.printStackTrace();
        }
        System.exit(1);
    }
    LOGGER.info("OK");
    LOGGER.info("");
}