Example usage for java.lang Throwable Throwable

List of usage examples for java.lang Throwable Throwable

Introduction

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

Prototype

public Throwable() 

Source Link

Document

Constructs a new throwable with null as its detail message.

Usage

From source file:org.o3project.ocnrm.odenos.linklayerizer.LinkLayerizer.java

private void startLog(String networkId) {
    logger.info("** {} Start", new Throwable().getStackTrace()[2].getMethodName());
    logger.info("** networkcomponentID:{}", networkId);
}

From source file:org.o3project.ocnrm.odenos.linklayerizer.LinkLayerizer.java

private void endLog(String networkId) {
    logger.info("** networkcomponentID:{}", networkId);
    logger.info("** {} End", new Throwable().getStackTrace()[2].getMethodName());
}

From source file:org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper.java

/**
 * If this is called in a unit test, that test will get a separate namespace
 * of ZK wrappers that will not collide with other unit tests. Uses the call
 * stack to auto-detect the calling function's name, so should be called
 * directly from a unit test method.//www . j  av a  2  s.  c  om
 */
public static void setNamespaceForTesting() {
    // Use the caller's method name.
    String namespace = new Throwable().getStackTrace()[1].getMethodName() + "_";
    LOG.debug("Using \"" + namespace + "\" as the ZK wrapper "
            + "namespace to avoid collisions between unit tests.");
    currentNamespaceForTesting = namespace;
}

From source file:hudson.model.Run.java

/**
 * @deprecated as of 1.292/*from   w w  w .java2 s  .c o m*/
 *      Use {@link #getEnvironment(TaskListener)} instead.
 */
@Deprecated
public Map<String, String> getEnvVars() {
    LOGGER.log(WARNING, "deprecated call to Run.getEnvVars\n\tat {0}", new Throwable().getStackTrace()[1]);
    try {
        return getEnvironment(new LogTaskListener(LOGGER, Level.INFO));
    } catch (IOException e) {
        return new EnvVars();
    } catch (InterruptedException e) {
        return new EnvVars();
    }
}

From source file:hudson.model.Run.java

/**
 * @deprecated as of 1.305 use {@link #getEnvironment(TaskListener)}
 */// w ww.  j  a  v  a2  s .com
@Deprecated
public EnvVars getEnvironment() throws IOException, InterruptedException {
    LOGGER.log(WARNING, "deprecated call to Run.getEnvironment\n\tat {0}", new Throwable().getStackTrace()[1]);
    return getEnvironment(new LogTaskListener(LOGGER, Level.INFO));
}

From source file:co.paralleluniverse.galaxy.core.Cache.java

void lockLine(CacheLine line, Transaction txn) {
    LOG.debug("Locking line {}", line);
    if (LOG.isTraceEnabled())
        LOG.trace("Locked:", new Throwable());
    line.lock();//w ww .j av  a 2s  .c om
    if (txn != null)
        txn.add(line.getId());
}

From source file:co.paralleluniverse.galaxy.core.Cache.java

boolean unlockLine(CacheLine line, Transaction txn) {
    LOG.debug("Unlocking line {}", line);
    if (LOG.isTraceEnabled())
        LOG.trace("Unlocked:", new Throwable());
    assert txn == null || txn.contains(line.getId());
    return line.unlock();
}

From source file:com.itemanalysis.psychometrics.optimization.BOBYQAOptimizer.java

private static String caller(int n) {
    final Throwable t = new Throwable();
    final StackTraceElement[] elements = t.getStackTrace();
    final StackTraceElement e = elements[n];
    return e.getMethodName() + " (at line " + e.getLineNumber() + ")";
}

From source file:com.zyk.launcher.AsyncTaskCallback.java

/**
 * Adds the specified child in the specified screen. The position and dimension of
 * the child are defined by x, y, spanX and spanY.
 *
 * @param child The child to add in one of the workspace's screens.
 * @param screenId The screen in which to add the child.
 * @param x The X position of the child in the screen's grid.
 * @param y The Y position of the child in the screen's grid.
 * @param spanX The number of cells spanned horizontally by the child.
 * @param spanY The number of cells spanned vertically by the child.
 * @param insert When true, the child is inserted at the beginning of the children list.
 * @param computeXYFromRank When true, we use the rank (stored in screenId) to compute
 *                          the x and y position in which to place hotseat items. Otherwise
 *                          we use the x and y position to compute the rank.
 *//*from  ww w. ja v a  2 s.c o  m*/
void addInScreen(View child, long container, long screenId, int x, int y, int spanX, int spanY, boolean insert,
        boolean computeXYFromRank) {
    if (container == LauncherSettings.Allapps.CONTAINER_ALLAPPS) {
        if (getScreenWithId(screenId) == null) {
            Log.e(TAG, "Skipping child, screenId " + screenId + " not found");
            // DEBUGGING - Print out the stack trace to see where we are adding from
            new Throwable().printStackTrace();
            return;
        }
    }
    if (screenId == Workspace.EXTRA_EMPTY_SCREEN_ID) {
        // This should never happen
        throw new RuntimeException("Screen id should not be EXTRA_EMPTY_SCREEN_ID");
    }

    final CellLayout layout;
    if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
        layout = mLauncher.getHotseat().getLayout();
        child.setOnKeyListener(new HotseatIconKeyEventListener());

        // Hide folder title in the hotseat
        if (child instanceof FolderIcon) {
            ((FolderIcon) child).setTextVisible(false);
        }

        if (computeXYFromRank) {
            x = mLauncher.getHotseat().getCellXFromOrder((int) screenId);
            y = mLauncher.getHotseat().getCellYFromOrder((int) screenId);
        } else {
            screenId = mLauncher.getHotseat().getOrderInHotseat(x, y);
        }
    } else {
        // Show folder title if not in the hotseat
        if (child instanceof FolderIcon) {
            ((FolderIcon) child).setTextVisible(true);
        }
        layout = getScreenWithId(screenId);
        child.setOnKeyListener(new IconKeyEventListener());
    }

    ViewGroup.LayoutParams genericLp = child.getLayoutParams();
    CellLayout.LayoutParams lp;
    if (genericLp == null || !(genericLp instanceof CellLayout.LayoutParams)) {
        lp = new CellLayout.LayoutParams(x, y, spanX, spanY);
    } else {
        lp = (CellLayout.LayoutParams) genericLp;
        lp.cellX = x;
        lp.cellY = y;
        lp.cellHSpan = spanX;
        lp.cellVSpan = spanY;
    }

    if (spanX < 0 && spanY < 0) {
        lp.isLockedToGrid = false;
    }

    // Get the canonical child id to uniquely represent this view in this screen
    ItemInfo info = (ItemInfo) child.getTag();
    int childId = mLauncher.getAllAppsViewIdForItem(info);

    boolean markCellsAsOccupied = !(child instanceof Folder);
    if (!layout.addViewToCellLayout(child, insert ? 0 : -1, childId, lp, markCellsAsOccupied)) {
        // TODO: This branch occurs when the workspace is adding views
        // outside of the defined grid
        // maybe we should be deleting these items from the LauncherModel?
        System.out.println("Failed to add to item at (" + lp.cellX + "," + lp.cellY + ") to CellLayout");
        Launcher.addDumpLog(TAG, "Failed to add to item at (" + lp.cellX + "," + lp.cellY + ") to CellLayout",
                true);
    }

    if (!(child instanceof Folder)) {
        child.setHapticFeedbackEnabled(false);
        child.setOnLongClickListener(mLongClickListener);
    }
    if (child instanceof DropTarget) {
        mDragController.addDropTarget((DropTarget) child);
    }
}