Example usage for java.lang Throwable printStackTrace

List of usage examples for java.lang Throwable printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

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

Usage

From source file:net.menthor.editor.v2.util.Util.java

public static void enableFullScreenMode(Window window) {
    String className = "com.apple.eawt.FullScreenUtilities";
    String methodName = "setWindowCanFullScreen";
    try {/*  w  ww  .  ja va  2  s  .c o  m*/
        Class<?> clazz = Class.forName(className);
        Method method = clazz.getMethod(methodName, new Class<?>[] { Window.class, boolean.class });
        method.invoke(null, window, true);
    } catch (Throwable t) {
        System.err.println("Full screen mode is not supported");
        t.printStackTrace();
    }
}

From source file:functionaltests.RestFuncTHelper.java

public static void stopRestfulSchedulerWebapp() {
    // Kill all rm nodes
    try {// w  ww .  ja v a 2  s.c  o m
        Set<String> urls = rm.listAliveNodeUrls();
        for (String nodeUrl : urls) {
            try {
                ProActiveRuntime runtime = (ProActiveRuntime) PARemoteObject.lookup(URI.create(nodeUrl));
                runtime.killRT(false);
            } catch (Throwable noNeed) {
            }
        }
        rm.shutdown(true);
    } catch (Throwable noNeed) {
    }

    System.out.println("Shutting down the scheduler.");
    try {
        scheduler.shutdown();
    } catch (Throwable ignore) {
    }

    // Destroy the scheduler process
    System.out.println("Shutting down scheduler process.");
    if (schedProcess != null) {
        try {
            RestFuncTUtils.destroy(schedProcess);
        } catch (Throwable error) {
            System.err.println("An error occurred while shutting down scheduler process:");
            error.printStackTrace();
        } finally {
            try {
                RestFuncTUtils.cleanupActiveObjectRegistry(SchedulerConstants.SCHEDULER_DEFAULT_NAME);
            } catch (Throwable error) {

            }
        }
    }
}

From source file:moe.encode.airblock.commands.contrib.annotations.AnnotationCommand.java

public static void throwError(String message, Throwable throwable, Executor executor) {
    Logger logger = executor.getEnvironment().getBackend().getLogger();

    if (logger != null) {
        logger.log(Level.SEVERE, message, throwable);
    } else {//w ww  .j  a  v  a 2  s .  c  om
        System.err.println(message);
        throwable.printStackTrace();
    }
}

From source file:Main.java

private static void handlePluginException(Throwable pluginException) {
    /*//from   ww  w. j a  va 2s . c o m
     * We don't want errors from the plugin to affect normal flow.
     * Since the plugin should never throw this is a safety net
     * and will complain loudly to System.err so it gets fixed.
     */
    System.err
            .println("RxJavaErrorHandler threw an Exception. It shouldn't. => " + pluginException.getMessage());
    pluginException.printStackTrace();
}

From source file:com.jaeksoft.searchlib.Logging.java

private final static boolean noLogger(PrintStream ps, Object msg, Throwable e) {
    if (logger != null)
        return false;
    if (msg != null)
        ps.println(msg);//from  w w  w .ja va  2  s .c o m
    if (e != null && isShowStackTrace())
        e.printStackTrace();
    return true;
}

From source file:edu.umd.cs.psl.model.kernel.setdefinition.SetDefinitionKernel.java

static final EntityAggregatorFunction parseDefinition(String definition) {
    try {//from w  w w. j  a v  a2 s  .c o m
        return DynamicClassLoader.loadClassArbitraryArgs(definition, definedSetComparatorFun,
                EntityAggregatorFunction.class);
    } catch (Throwable e) {
        e.printStackTrace();
        throw new AssertionError("Unknown similarity function: " + definition);
    }

}

From source file:atlas.kingj.roi.FrmMain.java

/**
 * Launch the application./*  w  ww  .  j av a2  s .c om*/
 */
public static void main(String[] args) {
    try {
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (Throwable e) {
        e.printStackTrace();
    }
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                window = new FrmMain();
                window.frmTitanRoiCalculator.setVisible(true);
                window.btnNewMachine.requestFocusInWindow();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:com.openteach.diamond.container.Container.java

/**
 * ?diamond//from  ww  w.j  ava  2  s  .  co m
 */
public static void stop() {
    try {
        fireLifecycleEvent(LifecycleListener.BEFORE_STOP_EVENT);
    } catch (Throwable t) {
        t.printStackTrace();
    }
    try {
        EclipseStarter.shutdown();
        context = null;
    } catch (Exception e) {
        System.err.println("?diamond:" + e);
        e.printStackTrace();
    }
    try {
        fireLifecycleEvent(LifecycleListener.AFTER_STOP_EVENT);
    } catch (Throwable e) {
        e.printStackTrace();
    }
}

From source file:com.l2jfree.util.concurrent.L2ThreadPool.java

public static void shutdown() {
    final long begin = System.currentTimeMillis();

    try {/*  ww  w .  j a v  a  2  s  .c  om*/
        System.out.println("L2ThreadPool: Shutting down.");
        System.out.println("\t... executing " + getTaskCount(_scheduledPools) + " scheduled tasks.");
        System.out.println("\t... executing " + getTaskCount(_instantPools) + " instant tasks.");
        System.out.println("\t... executing " + getTaskCount(_longRunningPools) + " long running tasks.");
    } catch (Throwable t) {
        t.printStackTrace();
    }

    try {
        for (ThreadPoolExecutor threadPool : getThreadPools()) {
            try {
                threadPool.shutdown();
            } catch (Throwable t) {
                t.printStackTrace();
            }
        }
    } catch (Throwable t) {
        t.printStackTrace();
    }

    boolean success = false;
    try {
        success |= awaitTermination(5000);

        for (ScheduledThreadPoolExecutor scheduledPool : _scheduledPools) {
            scheduledPool.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
            scheduledPool.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
        }

        success |= awaitTermination(10000);
    } catch (Throwable t) {
        t.printStackTrace();
    }

    try {
        System.out.println(
                "\t... success: " + success + " in " + (System.currentTimeMillis() - begin) + " msec.");
        System.out.println("\t... " + getTaskCount(_scheduledPools) + " scheduled tasks left.");
        System.out.println("\t... " + getTaskCount(_instantPools) + " instant tasks left.");
        System.out.println("\t... " + getTaskCount(_longRunningPools) + " long running tasks left.");

        if (TimeUnit.MINUTES.toMillis(30) < ManagementFactory.getRuntimeMXBean().getUptime())
            RunnableStatsManager.dumpClassStats(SortBy.TOTAL);
    } catch (Throwable t) {
        t.printStackTrace();
    }
}

From source file:com.bangalore.barcamp.BCBUtils.java

public static void syncUserScheduleData(Context context) {
    String userID = BCBSharedPrefUtils.getUserID(context);
    String userKey = BCBSharedPrefUtils.getUserKey(context);
    if (TextUtils.isEmpty(userKey) || TextUtils.isEmpty(userID)) {
        return;//from   w  ww . ja  v  a 2  s  .  c o  m
    }
    Boolean retVal = false;
    BufferedReader in = null;
    try {
        HttpClient client = new DefaultHttpClient();
        String userScheduleURL = String.format(BCB_USER_SCHEDULE_URL, userID, userKey);
        Log.e("UserURL", userScheduleURL);
        HttpUriRequest request = new HttpGet(userScheduleURL);
        HttpResponse response = client.execute(request);
        in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
        StringBuffer sb = new StringBuffer("");
        String line = "";
        String NL = System.getProperty("line.separator");
        while ((line = in.readLine()) != null) {
            sb.append(line + NL);
        }
        in.close();
        String page = sb.toString();
        if (page.length() > MAX_LOG) {
            int iCount = 0;
            for (; iCount < page.length() - MAX_LOG; iCount += MAX_LOG) {
                Log.e("schedule", page.substring(iCount, iCount + MAX_LOG));
            }
            Log.e("schedule", page.substring(iCount));
        } else {
            Log.e("schedule", page);
        }
        List<BarcampUserScheduleData> data = DataProcessingUtils.parseBCBScheduleJSON(page);
        ((BarcampBangalore) context).setUserSchedule(data);

    } catch (Throwable e) {
        e.printStackTrace();
    } finally {
        if (in != null) {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}