Example usage for java.lang Thread setDefaultUncaughtExceptionHandler

List of usage examples for java.lang Thread setDefaultUncaughtExceptionHandler

Introduction

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

Prototype

public static void setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler eh) 

Source Link

Document

Set the default handler invoked when a thread abruptly terminates due to an uncaught exception, and no other handler has been defined for that thread.

Usage

From source file:com.nikonhacker.gui.EmulatorUI.java

public static void main(String[] args) throws EmulationException, IOException, ClassNotFoundException,
        UnsupportedLookAndFeelException, IllegalAccessException, InstantiationException {

    // Workaround for JDK bug - https://code.google.com/p/nikon-firmware-tools/issues/detail?id=17
    System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");

    if (args.length > 0) {
        imageFile[Constants.CHIP_FR] = new File(args[0]);
        if (args.length > 1) {
            imageFile[Constants.CHIP_TX] = new File(args[1]);
        }//  w w w  .j a  v a  2  s .  com
    }

    initProgrammableTimerAnimationIcons(BUTTON_SIZE_SMALL);

    // a lot of calls are made from GUI in AWT thread that exits fast with no error code
    Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
        public void uncaughtException(Thread t, Throwable e) {
            e.printStackTrace();
            System.exit(1);
        }
    });

    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createAndShowGUI();
        }
    });
}

From source file:org.transdroid.core.gui.TorrentsActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    // Set the theme according to the user preference
    if (SystemSettings_.getInstance_(this).useDarkTheme()) {
        setTheme(R.style.TransdroidTheme_Dark);
    }/* w ww  .  j  a v  a2 s  . c o m*/
    // Catch any uncaught exception to log it
    Thread.setDefaultUncaughtExceptionHandler(
            new LogUncaughtExceptionHandler(this, Thread.getDefaultUncaughtExceptionHandler()));
    super.onCreate(savedInstanceState);
}

From source file:com.att.aro.ui.view.MainFrame.java

/**
 * Create the application.
 */
public MainFrame() {
    Thread.setDefaultUncaughtExceptionHandler(new CrashHandler());
    initialize();
}

From source file:interactivespaces.launcher.bootstrap.InteractiveSpacesFrameworkBootstrap.java

/**
 * Set up the default exception handler.
 *///from w w w . j  a v  a 2s. c  om
private void setupExceptionHandler() {
    Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread t, Throwable e) {
            loggingProvider.getLog().error(String.format("Caught uncaught exception from thread %s", t), e);
        }
    });
}

From source file:lcmc.LCMC.java

/** Inits the application. */
protected static String initApp(final String[] args) {
    try {/* w w w . j ava 2 s.  co  m*/
        /* Metal */
        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
        MetalLookAndFeel.setCurrentTheme(new OceanTheme() {
            /** e.g. arrows on split pane... */
            protected ColorUIResource getPrimary1() {
                return new ColorUIResource(ClusterBrowser.STATUS_BACKGROUND);
            }

            /** unknown to me */
            protected ColorUIResource getPrimary2() {
                return new ColorUIResource(ClusterBrowser.PANEL_BACKGROUND);
            }

            /** unknown to me */
            protected ColorUIResource getPrimary3() {
                return new ColorUIResource(ClusterBrowser.PANEL_BACKGROUND);
            }

            /** Button and other borders. */
            protected ColorUIResource getSecondary1() {
                return new ColorUIResource(AppDefaults.BACKGROUND_DARK);
            }

            protected ColorUIResource getSecondary2() {
                return new ColorUIResource(ClusterBrowser.PANEL_BACKGROUND);
            }

            /** Split pane divider. Line in the main menu. */
            protected ColorUIResource getSecondary3() {
                return new ColorUIResource(ClusterBrowser.PANEL_BACKGROUND);
            }
        });
    } catch (final Exception e) {
        /* ignore it then */
    }
    Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
        public void uncaughtException(final Thread t, final Throwable ex) {
            Tools.appError("uncaught exception", ex.toString(), (Exception) ex);
        }
    });
    float fps = 20.0f;
    final Options options = new Options();

    options.addOption("h", HELP_OP, false, "print this help");
    options.addOption(null, KEEP_HELPER_OP, false, "do not overwrite the lcmc-gui-helper program");
    options.addOption(null, RO_OP, false, "read only mode");
    options.addOption(null, OP_OP, false, "operator mode");
    options.addOption(null, ADMIN_OP, false, "administrator mode");
    options.addOption(null, OP_MODE_OP, true, "operating mode. <arg> can be:\n" + "ro - read only\n"
            + "op - operator\n" + "admin - administrator");
    options.addOption(null, NOLRM_OP, false, "do not show removed resources from LRM.");
    options.addOption(null, "auto", true, "for testing");
    options.addOption("v", VERSION_OP, false, "print version");
    options.addOption(null, AUTO_OP, true, "for testing");
    options.addOption(null, NO_UPGRADE_CHECK_OP, false, "disable upgrade check");
    options.addOption(null, NO_PLUGIN_CHECK_OP, false,
            "disable plugin check, DEPRECATED: there are no plugins");
    options.addOption(null, TIGHTVNC_OP, false, "enable tight vnc viewer");
    options.addOption(null, ULTRAVNC_OP, false, "enable ultra vnc viewer");
    options.addOption(null, REALVNC_OP, false, "enable real vnc viewer");
    options.addOption(null, BIGDRBDCONF_OP, false,
            "create one big drbd.conf, instead of many" + " files in drbd.d/ directory");
    options.addOption(null, STAGING_DRBD_OP, false, "enable more DRBD installation options");
    options.addOption(null, STAGING_PACEMAKER_OP, false, "enable more Pacemaker installation options");
    options.addOption(null, VNC_PORT_OFFSET_OP, true, "offset for port forwarding");
    options.addOption(null, SLOW_OP, false, "specify this if you have slow computer");
    options.addOption(null, RESTORE_MOUSE_OP, false, "for testing");
    options.addOption(null, SCALE_OP, true, "scale fonts and sizes of elements in percent (100)");
    options.addOption(null, ID_DSA_OP, true, "location of id_dsa file ($HOME/.ssh/id_dsa)");
    options.addOption(null, ID_RSA_OP, true, "location of id_rsa file ($HOME/.ssh/id_rsa)");
    options.addOption(null, KNOWN_HOSTS_OP, true, "location of known_hosts file ($HOME/.ssh/known_hosts)");
    options.addOption(null, OUT_OP, true, "where to redirect the standard out");
    options.addOption(null, DEBUG_OP, true, "debug level, 0 - none, 3 - all");
    options.addOption("c", CLUSTER_OP, true, "define a cluster");
    final Option hostOp = new Option("h", HOST_OP, true, "define a cluster, used with --cluster option");
    hostOp.setArgs(10000);
    options.addOption(hostOp);
    options.addOption(null, SUDO_OP, false, "whether to use sudo, used with --cluster option");
    options.addOption(null, USER_OP, true, "user to use with sudo, used with --cluster option");
    options.addOption(null, PORT_OP, true, "ssh port, used with --cluster option");
    options.addOption(null, ADVANCED_OP, false, "start in an advanced mode");
    options.addOption(null, ONE_HOST_CLUSTER_OP, false, "allow one host cluster");
    final CommandLineParser parser = new PosixParser();
    String autoArgs = null;
    try {
        final CommandLine cmd = parser.parse(options, args);
        if (cmd.hasOption(OUT_OP)) {
            final String out = cmd.getOptionValue(OUT_OP);
            if (out != null) {
                try {
                    System.setOut(new PrintStream(new FileOutputStream(out)));
                } catch (final FileNotFoundException e) {
                    System.exit(2);
                }
            }
        }
        if (cmd.hasOption(DEBUG_OP)) {
            final String level = cmd.getOptionValue(DEBUG_OP);
            if (level != null && Tools.isNumber(level)) {
                Tools.setDebugLevel(Integer.parseInt(level));
            } else {
                throw new ParseException("cannot parse debug level: " + level);
            }
        }
        boolean tightvnc = cmd.hasOption(TIGHTVNC_OP);
        boolean ultravnc = cmd.hasOption(ULTRAVNC_OP);
        final boolean realvnc = cmd.hasOption(REALVNC_OP);
        if (!tightvnc && !ultravnc && !realvnc) {
            if (Tools.isLinux()) {
                tightvnc = true;
            } else if (Tools.isWindows()) {
                ultravnc = true;
            } else {
                tightvnc = true;
                ultravnc = true;
            }
        }
        boolean advanced = cmd.hasOption(ADVANCED_OP);
        Tools.getConfigData().setAdvancedMode(advanced);
        Tools.getConfigData().setTightvnc(tightvnc);
        Tools.getConfigData().setUltravnc(ultravnc);
        Tools.getConfigData().setRealvnc(realvnc);

        Tools.getConfigData().setUpgradeCheckEnabled(!cmd.hasOption(NO_UPGRADE_CHECK_OP));
        Tools.getConfigData().setBigDRBDConf(cmd.hasOption(BIGDRBDCONF_OP));
        Tools.getConfigData().setStagingDrbd(cmd.hasOption(STAGING_DRBD_OP));
        Tools.getConfigData().setStagingPacemaker(cmd.hasOption(STAGING_PACEMAKER_OP));
        Tools.getConfigData().setNoLRM(cmd.hasOption(NOLRM_OP));
        Tools.getConfigData().setKeepHelper(cmd.hasOption(KEEP_HELPER_OP));
        Tools.getConfigData().setOneHostCluster(cmd.hasOption(ONE_HOST_CLUSTER_OP));
        final String pwd = System.getProperty("user.home");
        final String scaleOp = cmd.getOptionValue(SCALE_OP, "100");
        try {
            final int scale = Integer.parseInt(scaleOp);
            Tools.getConfigData().setScale(scale);
            Tools.resizeFonts(scale);
        } catch (java.lang.NumberFormatException e) {
            Tools.appWarning("cannot parse scale: " + scaleOp);
        }

        final String idDsaPath = cmd.getOptionValue(ID_DSA_OP, pwd + "/.ssh/id_dsa");
        final String idRsaPath = cmd.getOptionValue(ID_RSA_OP, pwd + "/.ssh/id_rsa");
        final String knownHostsPath = cmd.getOptionValue(KNOWN_HOSTS_OP, pwd + "/.ssh/known_hosts");
        Tools.getConfigData().setIdDSAPath(idDsaPath);
        Tools.getConfigData().setIdRSAPath(idRsaPath);
        Tools.getConfigData().setKnownHostPath(knownHostsPath);

        final String opMode = cmd.getOptionValue(OP_MODE_OP);
        autoArgs = cmd.getOptionValue(AUTO_OP);
        if (cmd.hasOption(HELP_OP)) {
            final HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("java -jar LCMC.jar [OPTIONS]", options);
            System.exit(0);
        }
        if (cmd.hasOption(VERSION_OP)) {
            System.out.println("LINUX CLUSTER MANAGEMENT CONSOLE " + Tools.getRelease() + " by Rasto Levrinc");
            System.exit(0);
        }
        if (cmd.hasOption("ro") || "ro".equals(opMode)) {
            Tools.getConfigData().setAccessType(ConfigData.AccessType.RO);
            Tools.getConfigData().setMaxAccessType(ConfigData.AccessType.RO);
        } else if (cmd.hasOption("op") || "op".equals(opMode)) {
            Tools.getConfigData().setAccessType(ConfigData.AccessType.OP);
            Tools.getConfigData().setMaxAccessType(ConfigData.AccessType.OP);
        } else if (cmd.hasOption("admin") || "admin".equals(opMode)) {
            Tools.getConfigData().setAccessType(ConfigData.AccessType.ADMIN);
            Tools.getConfigData().setMaxAccessType(ConfigData.AccessType.ADMIN);
        } else if (opMode != null) {
            Tools.appWarning("unknown operating mode: " + opMode);
        }
        if (cmd.hasOption(SLOW_OP)) {
            fps = fps / 2;
        }
        if (cmd.hasOption(RESTORE_MOUSE_OP)) {
            /* restore mouse if it is stuck in pressed state, during
             * robot tests. */
            RoboTest.restoreMouse();
        }
        final String vncPortOffsetString = cmd.getOptionValue(VNC_PORT_OFFSET_OP);
        if (vncPortOffsetString != null && Tools.isNumber(vncPortOffsetString)) {
            Tools.getConfigData().setVncPortOffset(Integer.parseInt(vncPortOffsetString));
        }
        Tools.getConfigData().setAnimFPS(fps);
        if (cmd.hasOption(CLUSTER_OP) || cmd.hasOption(HOST_OP)) {
            parseClusterOptions(cmd);
        }
    } catch (ParseException exp) {
        System.out.println("ERROR: " + exp.getMessage());
        System.exit(1);
    }
    Tools.debug(null, "max mem: " + Runtime.getRuntime().maxMemory() / 1024 / 1024 + "m", 1);
    return autoArgs;
}

From source file:org.de.jmg.learn.MainActivity.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    blnTextToSpeech = false;//from   w  ww  . j a v a2s. com
    lib.main = this;

    //getting the kind of userinterface: television or watch or else
    int UIMode = lib.getUIMode(this);
    switch (UIMode) {
    case Configuration.UI_MODE_TYPE_TELEVISION:
        isTV = true;
        break;
    case Configuration.UI_MODE_TYPE_WATCH:
        isWatch = true;
        break;
    }

    if (savedInstanceState != null) {
        JMGDataDirectory = savedInstanceState.getString("JMGDataDirectory");
    }

    setContentView(R.layout.activity_main_viewpager);

    /** Getting a reference to ViewPager from the layout */
    View pager = this.findViewById(R.id.pager);
    Layout = (ViewGroup) pager;
    mPager = (ViewPager) pager;

    /** Getting a reference to FragmentManager */
    FragmentManager fm = getSupportFragmentManager();

    setPageChangedListener();

    /** Creating an instance of FragmentPagerAdapter */
    if (fPA == null) {
        fPA = new MyFragmentPagerAdapter(fm, this, savedInstanceState != null);
    }

    /** Setting the FragmentPagerAdapter object to the viewPager object */
    mPager.setAdapter(fPA);
    //mPager.setCurrentItem(0);

    libLearn.gStatus = "onCreate getEink";
    try {
        _blnEink = getWindowManager().getDefaultDisplay().getRefreshRate() < 5.0;
        if (_blnEink)
            lib.ShowToast(this, "This is an Eink diplay!");
    } catch (Exception ex) {
        lib.ShowException(this, ex);
    }

    try {
        libLearn.gStatus = "onCreate setContentView";
        mainView = findViewById(Window.ID_ANDROID_CONTENT);
        defaultErrorHandler = Thread.getDefaultUncaughtExceptionHandler();
        Thread.setDefaultUncaughtExceptionHandler(ErrorHandler);

        // View LayoutMain = findViewById(R.id.layoutMain);

        processPreferences(savedInstanceState != null);

        libLearn.gStatus = "onCreate Copy Assets";
        CopyAssets();

        try {
            processBundle(savedInstanceState);
        } catch (Exception e) {

            e.printStackTrace();
            lib.ShowException(this, e);
        }
        //InitSettings();
        Intent intent = getIntent();
        if (Intent.ACTION_VIEW.equals(intent.getAction())) {
            Uri uri = intent.getData();
            if (uri.toString().startsWith("loginquizlet:/")) {
                loginQuizlet = new LoginQuizletActivity();
                this.onNewIntent(intent);
            }

            //finish();
        }

    } catch (Exception ex) {
        lib.ShowException(this, ex);
    }

}

From source file:de.tor.tribes.ui.windows.DSWorkbenchSplashScreen.java

/**
 * @param args the command line arguments
 *//*  ww w.j  a v  a  2 s  . c  om*/
public static void main(String args[]) {
    Locale.setDefault(Locale.GERMAN);
    int mode = -1;
    int minimal = 0;
    boolean ssd = false;
    if (args != null) {
        for (String arg : args) {
            switch (arg) {
            case "-d":
            case "--debug":
                //debug mode
                mode = 0;
                SystrayHelper.showInfoMessage("Running in debug mode");
                break;
            case "-m":
                minimal = 1;
                break;
            case "-ssd":
                ssd = true;
                break;
            }
        }
    }
    Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler());
    System.setProperty("sun.awt.exception.handler", ExceptionHandler.class.getName());

    if (mode == 0) {
        Configurator.setAllLevels(LogManager.getRootLogger().getName(), Level.DEBUG);
    }
    GlobalOptions.setMinimalVersion(minimal == 1);

    try {
        GlobalDefaults.initialize();
        GlobalOptions.initialize();
        //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
        logger.error("Failed to setup LnF", e);
    }

    final boolean useSSD = ssd;

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            try {
                DSWorkbenchSplashScreen.getSingleton().setLocationRelativeTo(null);
                if (useSSD) {
                    DSWorkbenchSplashScreen.getSingleton().initializeSuperSpecialDebugFeatures();
                }
                DSWorkbenchSplashScreen.getSingleton().setVisible(true);
            } catch (Exception e) {
                logger.error("Fatal application error", e);
            }
        }
    });
}

From source file:com.diversityarrays.kdxplore.KDXploreFrame.java

KDXploreFrame(ApplicationFolder appFolder, String title, int versionCode, String version,
        Closure<UpdateCheckContext> updateChecker) throws IOException {
    super(title);

    this.applicationFolder = appFolder;
    this.baseTitle = title;
    this.versionCode = versionCode;
    this.version = version;
    this.updateChecker = updateChecker;

    KdxploreConfig config = KdxploreConfig.getInstance();
    this.onlineHelpUrl = config.getOnlineHelpUrl();

    String supportEmail = config.getSupportEmail();
    if (Check.isEmpty(supportEmail)) {
        supportEmail = "someone@somewhere"; //$NON-NLS-1$
    }//w w w .  j  ava  2 s.c o m
    DefaultUncaughtExceptionHandler eh = new DefaultUncaughtExceptionHandler(this,
            appFolder.getApplicationName() + "_Error", //$NON-NLS-1$
            supportEmail, version + "(" + versionCode + ")"); //$NON-NLS-1$ //$NON-NLS-2$
    Thread.setDefaultUncaughtExceptionHandler(eh);
    MsgBox.DEFAULT_PROBLEM_REPORTER = eh;

    this.userDataFolder = applicationFolder.getUserDataFolder();

    this.loginUrlsProvider = new PropertiesLoginUrlsProvider(CommandArgs.getPropertiesFile(applicationFolder));

    displayVersion = RunMode.getRunMode().isDeveloper() ? version + "-dev" //$NON-NLS-1$
            : version;

    List<? extends Image> iconImages = loadIconImages();
    iconImage = iconImageBig != null ? iconImageBig : iconImageSmall;
    kdxploreIcon = new ImageIcon(iconImageSmall != null ? iconImageSmall : iconImageBig);
    setIconImages(iconImages);

    if (Util.isMacOS()) {
        try {
            System.setProperty("apple.laf.useScreenMenuBar", "true"); //$NON-NLS-1$ //$NON-NLS-2$

            macapp = new MacApplication(null);
            macapp.setAboutHandler(aboutAction);
            macapp.setQuitHandler(exitAction);
            if (iconImage != null) {
                macapp.setDockIconImage(iconImage);
            }
            macapp.setPreferencesHandler(settingsAction);
            macapp.setAboutHandler(aboutAction);
            macapp.setQuitHandler(exitAction);
        } catch (MacApplicationException e) {
            macapp = null;
            Shared.Log.w(TAG, "isMacOS", e); //$NON-NLS-1$
        }
    }

    if (iconImage != null) {
        this.setIconImage(iconImage);
    }

    clientProvider = new DefaultDALClientProvider(this, loginUrlsProvider, createBrandingImageComponent());
    clientProvider.setCanChangeUrl(false);
    clientProvider.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            handleClientChanged();
        }
    });

    connectDisconnectActions = new ConnectDisconnectActions(clientProvider, Msg.TOOLTIP_CONNECT_TO_DATABASE(),
            Msg.TOOLTIP_DISCONNECT_FROM_DATABASE());
    connectDisconnectActions.setConnectIntercept(connectIntercept);

    desktopSupport = new DefaultDesktopSupport(KDXploreFrame.this, baseTitle);

    frameWindowOpener = new DefaultFrameWindowOpener(desktopSupport) {
        @Override
        public Image getIconImage() {
            return iconImage;
        }
    };
    frameWindowOpener.setOpenOnSameScreenAs(KDXploreFrame.this);

    setGlassPane(desktopSupport.getBlockingPane());

    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);

    addWindowListener(windowListener);

    initialiseKdxApps();

    JMenuBar mb = buildMenuBar();

    if (iconImage != null) {
        backgroundPanel.setBackgroundImage(iconImage);
    } else {
        backgroundPanel.setBackgroundImage(KDClientUtils.getImage(ImageId.DART_LOGO_128x87));
    }
    backgroundPanel.setBackground(Color.decode("0xccffff")); //$NON-NLS-1$

    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cardPanel, messagesPanel);
    splitPane.setResizeWeight(0.8);

    // = = = = = =

    Container cp = getContentPane();
    cp.add(splitPane, BorderLayout.CENTER);

    statusInfoLine.setHorizontalAlignment(SwingConstants.LEFT);
    logoImagesLabel = new LogoImagesLabel();
    JPanel bottom = new JPanel(new BorderLayout());
    bottom.add(statusInfoLine, BorderLayout.CENTER);
    bottom.add(logoImagesLabel, BorderLayout.EAST);
    cp.add(bottom, BorderLayout.SOUTH);

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent e) {
            removeWindowListener(this);
            logoImagesLabel.startCycling();
        }
    });

    showCard(CARD_KDXAPPS);

    setJMenuBar(mb);

    pack();

    Dimension size = getSize();
    boolean changed = false;
    if (size.width < MINIMUM_SIZE.width) {
        size.width = MINIMUM_SIZE.width;
        changed = true;
    }
    if (size.height < MINIMUM_SIZE.height) {
        size.height = MINIMUM_SIZE.height;
        changed = true;
    }
    if (changed) {
        setSize(size);
    }

    setLocationRelativeTo(null);

    final MemoryUsageMonitor mum = new MemoryUsageMonitor();
    mum.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            updateStatusLineWithMemoryUsage(mum.getMemoryUsage());
        }
    });
}

From source file:com.cloudmine.api.db.RequestPerformerService.java

/**
 * This intercepts any uncaught exceptions and restarts the service
 *///from w w w  .j a v  a2s  .  c  om
private void catchUncaughtExceptions() {
    final Context applicationContext = getApplicationContext();
    Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread thread, Throwable throwable) {

            LOG.error("Crashed, restarting service ", throwable);
            applicationContext.startService(new Intent(applicationContext, RequestPerformerService.class));

            android.os.Process.killProcess(android.os.Process.myPid());
            System.exit(0);
        }
    });
}

From source file:org.apache.rya.accumulo.mr.merge.MergeTool.java

public static void main(final String[] args) {
    final String log4jConfiguration = System.getProperties().getProperty("log4j.configuration");
    if (StringUtils.isNotBlank(log4jConfiguration)) {
        final String parsedConfiguration = StringUtils.removeStart(log4jConfiguration, "file:");
        final File configFile = new File(parsedConfiguration);
        if (configFile.exists()) {
            DOMConfigurator.configure(parsedConfiguration);
        } else {/*from www. j  a  va  2  s.co  m*/
            BasicConfigurator.configure();
        }
    }
    log.info("Starting Merge Tool");

    Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(final Thread thread, final Throwable throwable) {
            log.error("Uncaught exception in " + thread.getName(), throwable);
        }
    });

    final int returnCode = setupAndRun(args);

    log.info("Finished running Merge Tool");

    System.exit(returnCode);
}