Example usage for java.lang Throwable fillInStackTrace

List of usage examples for java.lang Throwable fillInStackTrace

Introduction

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

Prototype

public synchronized Throwable fillInStackTrace() 

Source Link

Document

Fills in the execution stack trace.

Usage

From source file:uk.nhs.cfh.dsp.srth.desktop.actions.querycrud.core.actions.LoadSavedQueryTask.java

/**
 * Failed./*from   w w  w . j av  a 2  s  .c  o m*/
 *
 * @param e the e
 */
@Override
protected void failed(Throwable e) {
    String simpleMessage = "Error loading query from file " + fileSelected
            + " Check file exists and is readable.";
    setMessage(simpleMessage);
    applicationService.notifyError(simpleMessage, e, Level.WARNING);
    logger.warn(simpleMessage + "Nested exception is : " + e.fillInStackTrace().getMessage());
}

From source file:org.eclipse.vjet.dsf.common.trace.DefaultTracer.java

public void exitMethod(final Object caller, final ExitStatus status, final String msg) {
    if (!m_traceEnabled) {
        return;//  ww w  .jav a  2  s . c  o  m
    }

    if (caller == null) {
        return;
    }

    final Throwable t = new Throwable();
    t.fillInStackTrace();

    final String clsName = getClassName(caller);
    final String methodName = getMethodName(caller, t);

    dispatch(new WriterInvoker() {
        public void process(ITraceWriter w) {
            w.handleExitMethod(m_traceDepth, clsName, methodName, status, msg);
        }
    });

    pop(clsName + DOT + methodName);
}

From source file:org.eclipse.vjet.dsf.common.trace.DefaultTracer.java

public void enterMethod(final Object caller) {

    if (!m_traceEnabled) {
        return;/*  w w w.j a  va 2s . com*/
    }

    if (caller == null) {
        return;
    }

    final Throwable t = new Throwable();
    t.fillInStackTrace();

    final String clsName = getClassName(caller);
    final String methodName = getMethodName(caller, t);

    push(clsName + DOT + methodName);

    dispatch(new WriterInvoker() {
        public void process(ITraceWriter w) {
            w.handleEnterMethod(m_traceDepth, clsName, methodName);
        }
    });
}

From source file:org.eclipse.vjet.dsf.common.trace.DefaultTracer.java

public void enterMethod(final Object caller, final String msg) {

    if (!m_traceEnabled) {
        return;/*from w  ww . j a  va  2  s  .  c om*/
    }

    if (caller == null) {
        return;
    }

    final Throwable t = new Throwable();
    t.fillInStackTrace();

    final String clsName = getClassName(caller);
    final String methodName = getMethodName(caller, t);

    push(clsName + DOT + methodName);

    dispatch(new WriterInvoker() {
        public void process(ITraceWriter w) {
            w.handleEnterMethod(m_traceDepth, clsName, methodName, msg);
        }
    });
}

From source file:org.eclipse.vjet.dsf.common.trace.DefaultTracer.java

public void exitMethod(final Object caller) {

    if (!m_traceEnabled) {
        return;//  www  .ja  va2s .  c om
    }

    if (caller == null) {
        return;
    }

    final Throwable t = new Throwable();
    t.fillInStackTrace();

    final String clsName = getClassName(caller);
    final String methodName = getMethodName(caller, t);

    dispatch(new WriterInvoker() {
        public void process(ITraceWriter w) {
            w.handleExitMethod(m_traceDepth, clsName, methodName);
        }
    });

    pop(clsName + DOT + methodName);
}

From source file:org.eclipse.vjet.dsf.common.trace.DefaultTracer.java

public void exitMethod(final Object caller, final ExitStatus status) {

    if (!m_traceEnabled) {
        return;//from  w w  w.jav  a2  s  .  c o  m
    }

    if (caller == null) {
        return;
    }

    final Throwable t = new Throwable();
    t.fillInStackTrace();

    final String clsName = getClassName(caller);
    final String methodName = getMethodName(caller, t);

    dispatch(new WriterInvoker() {
        public void process(ITraceWriter w) {
            w.handleExitMethod(m_traceDepth, clsName, methodName, status);
        }
    });

    pop(clsName + DOT + methodName);
}

From source file:org.eclipse.vjet.dsf.common.trace.DefaultTracer.java

public void exitMethod(final Object caller, final String msg) {

    if (!m_traceEnabled) {
        return;/*from w ww .  ja  v  a2  s .  c o m*/
    }

    if (caller == null) {
        return;
    }

    final Throwable t = new Throwable();
    t.fillInStackTrace();

    final String clsName = getClassName(caller);
    final String methodName = getMethodName(caller, t);

    dispatch(new WriterInvoker() {
        public void process(ITraceWriter w) {
            w.handleExitMethod(m_traceDepth, clsName, methodName, msg);
        }
    });

    pop(clsName + DOT + methodName);
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.resultexplanationpanel.ResultsExplanationPanel.java

/**
 * Query statistics collection changed.// w ww.ja v a 2s  . c  o  m
 * 
 * @param statisticsCollectionMap the statistics collection map
 */
public void queryStatisticsCollectionChanged(
        Map<QueryExpression, QueryStatisticsCollection> statisticsCollectionMap) {

    // get map and populate tree model in a separate task
    class PopulateExplanationTask extends Task<Void, Void> {

        PopulateExplanationTask(Application application) {
            super(application);
        }

        @Override
        protected Void doInBackground() throws Exception {

            // clear existing stats
            statsMap.clear();

            // get tables map and generate stats
            Map<QueryExpression, QueryStatisticsCollection> tablesMap = sqlQueryEngineService
                    .getQueryStatisticsCollectionMap();
            for (QueryExpression expression : tablesMap.keySet()) {
                // update result set count
                QueryStatisticsCollection coll = tablesMap.get(expression);
                //                    coll.setResultSetSize(coll.getResultSetSize(sqlQueryEngineService.getConnection()));
                // save object
                statsMap.put(expression, coll);
            }

            // refresh tree table model
            tableModel.updateStats(queryService.getActiveQuery(), statsMap);
            // resize all columns
            treeTable.packAll();

            return null;
        }

        @Override
        protected void succeeded(Void aVoid) {
            setMessage("Updated explanations in Results Explanation Panel");
        }

        @Override
        protected void failed(Throwable throwable) {
            setMessage("Failed to update explanations in Results Explanation Panel.");
            logger.warn("The nested exception is " + throwable.fillInStackTrace());
        }
    }

    // run update task only if the sqlQueryEngineService status is set to debug. it wont collect statistics otherwise.
    if (SQLQueryEngineService.EngineStatus.DEBUG == sqlQueryEngineService.getStatus()) {
        // create and execute task
        PopulateExplanationTask task = new PopulateExplanationTask(applicationService.getActiveApplication());
        applicationService.getActiveApplication().getContext().getTaskService().execute(task);
    }
}

From source file:org.eclipse.epp.internal.logging.aeri.ui.LogListenerTest.java

@Test
public void testServerProblemIgnoreHandled() {
    Throwable t1 = new Throwable();
    t1.fillInStackTrace();
    Status s1 = new Status(IStatus.ERROR, TEST_PLUGIN_ID, "test message", t1);
    ErrorReport report = Reports.newErrorReport(s1, settings, configuration);

    ProblemStatus status = new ProblemStatus();
    status.setIncidentFingerprint(Reports.traceIdentityHash(report));
    status.setBugUrl("http://the.url");
    status.setAction(RequiredAction.IGNORE);

    when(problemStatusIndex.seen(org.mockito.Matchers.any(ErrorReport.class))).thenReturn(Optional.of(status));

    sut.logging(s1, "");

    verifyNoErrorReportLogged();//from w w w  . ja  v a  2  s . com
}

From source file:org.eclipse.epp.internal.logging.aeri.ui.LogListenerTest.java

@Test
public void testNoAcceptingOtherPackages() {
    Throwable t = new RuntimeException();
    t.fillInStackTrace();
    StackTraceElement[] stackTrace = t.getStackTrace();
    stackTrace[0] = new StackTraceElement("any.third.party.Clazz", "thirdPartyMethod", "Clazz.java", 42);
    t.setStackTrace(stackTrace);/*from  w w  w.j a v  a 2 s  .com*/
    Status status = new Status(IStatus.ERROR, TEST_PLUGIN_ID, "Error Message", t);

    configuration.setAcceptOtherPackages(false);

    sut.logging(status, "");
    verifyNoErrorReportLogged();
}