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:org.gradle.api.internal.file.archive.ZipCopyActionTest.java

private FileCopyDetailsInternal brokenFile(final String path, final Throwable failure) {
    final FileCopyDetailsInternal details = context.mock(FileCopyDetailsInternal.class,
            String.format("[%s]", path));

    context.checking(new Expectations() {
        {/*from   w ww  . ja  v  a  2s.  c o m*/
            allowing(details).getRelativePath();
            will(returnValue(RelativePath.parse(true, path)));

            allowing(details).getLastModified();
            will(returnValue(1000L));

            allowing(details).isDirectory();
            will(returnValue(false));

            allowing(details).getMode();
            will(returnValue(1));

            allowing(details).copyTo(with(notNullValue(OutputStream.class)));
            will(new org.jmock.api.Action() {
                public void describeTo(Description description) {
                    description.appendText("write content");
                }

                public Object invoke(Invocation invocation) throws Throwable {
                    failure.fillInStackTrace();
                    throw failure;
                }
            });
        }
    });

    return details;
}

From source file:org.gradle.api.internal.file.archive.TarCopySpecVisitorTest.java

private FileVisitDetails brokenFile(final String path, final Throwable failure) {
    final FileVisitDetails details = context.mock(FileVisitDetails.class, String.format("[%s]", path));

    context.checking(new Expectations() {
        {/*from  w  w w  . ja v  a2  s  .  c o  m*/
            allowing(details).getRelativePath();
            will(returnValue(RelativePath.parse(true, path)));

            allowing(details).getLastModified();
            will(returnValue(1000L));

            allowing(details).getSize();
            will(returnValue(1000L));

            allowing(details).isDirectory();
            will(returnValue(false));

            allowing(details).getMode();
            will(returnValue(1));

            allowing(details).copyTo(with(notNullValue(OutputStream.class)));
            will(new Action() {
                public void describeTo(Description description) {
                    description.appendText("write content");
                }

                public Object invoke(Invocation invocation) throws Throwable {
                    failure.fillInStackTrace();
                    throw failure;
                }
            });
        }
    });

    return details;
}

From source file:com.mylikes.likes.etchasketch.Slate.java

public void commitStroke() {
    if (mTiledCanvas == null) {
        final Throwable e = new Throwable();
        e.fillInStackTrace();
        Log.v(TAG, "commitStroke before mTiledCanvas inited", e);
        return;//from  w  w w .j ava  2 s.co  m
    }
    mTiledCanvas.commit();
}

From source file:org.gradle.api.internal.file.archive.TarCopyActionTest.java

private FileCopyDetailsInternal brokenFile(final String path, final Throwable failure) {
    final FileCopyDetailsInternal details = context.mock(FileCopyDetailsInternal.class,
            String.format("[%s]", path));

    context.checking(new Expectations() {
        {/*from   ww  w.ja  va 2 s  .  co m*/
            allowing(details).getRelativePath();
            will(returnValue(RelativePath.parse(true, path)));

            allowing(details).getLastModified();
            will(returnValue(1000L));

            allowing(details).getSize();
            will(returnValue(1000L));

            allowing(details).isDirectory();
            will(returnValue(false));

            allowing(details).getMode();
            will(returnValue(1));

            allowing(details).copyTo(with(notNullValue(OutputStream.class)));
            will(new org.jmock.api.Action() {
                public void describeTo(Description description) {
                    description.appendText("write content");
                }

                public Object invoke(Invocation invocation) throws Throwable {
                    failure.fillInStackTrace();
                    throw failure;
                }
            });
        }
    });

    return details;
}

From source file:edu.stanford.muse.util.Util.java

public static String stackTrace() {
    Throwable t = new Exception("Printing current stack trace");
    t.fillInStackTrace();
    return stackTrace(t);
}