Example usage for java.lang Throwable getMessage

List of usage examples for java.lang Throwable getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.lenovo.tensorhusky.common.utils.ProcfsBasedProcessTree.java

/**
 * Update memory related information/*from  ww  w . j  a  v a 2 s .c  o m*/
 *
 * @param pInfo
 * @param procfsDir
 */
private static void constructProcessSMAPInfo(ProcessTreeSmapMemInfo pInfo, String procfsDir) {
    BufferedReader in = null;
    InputStreamReader fReader = null;
    try {
        File pidDir = new File(procfsDir, pInfo.getPid());
        File file = new File(pidDir, SMAPS);
        if (!file.exists()) {
            return;
        }
        fReader = new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"));
        in = new BufferedReader(fReader);
        ProcessSmapMemoryInfo memoryMappingInfo = null;
        List<String> lines = IOUtils.readLines(in);
        for (String line : lines) {
            line = line.trim();
            try {
                Matcher address = ADDRESS_PATTERN.matcher(line);
                if (address.find()) {
                    memoryMappingInfo = new ProcessSmapMemoryInfo(line);
                    memoryMappingInfo.setPermission(address.group(4));
                    pInfo.getMemoryInfoList().add(memoryMappingInfo);
                    continue;
                }
                Matcher memInfo = MEM_INFO_PATTERN.matcher(line);
                if (memInfo.find()) {
                    String key = memInfo.group(1).trim();
                    String value = memInfo.group(2).replace(KB, "").trim();
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("MemInfo : " + key + " : Value  : " + value);
                    }
                    memoryMappingInfo.setMemInfo(key, value);
                }
            } catch (Throwable t) {
                LOG.warn("Error parsing smaps line : " + line + "; " + t.getMessage());
            }
        }
    } catch (FileNotFoundException f) {
        LOG.error(f.getMessage());
    } catch (IOException e) {
        LOG.error(e.getMessage());
    } catch (Throwable t) {
        LOG.error(t.getMessage());
    } finally {
        IOUtils.closeQuietly(in);
    }
}

From source file:net.shibboleth.idp.oidc.OIDCException.java

/**
 * Instantiates a new Oidc exception./*from   ww  w  .jav a  2  s . c o m*/
 *
 * @param cause   the cause
 */
public OIDCException(final Throwable cause) {
    this(cause.getMessage(), cause);
}

From source file:dap4.servlet.CDMDSP.java

/**
 * Make sure that NC4Iosp is registered and library loaded
 *///www . ja  va  2s  . co  m
static public void loadNc4Iosp() throws DapException {
    if (nc4loaded)
        return;
    nc4loaded = true;
    if (!NetcdfFile.iospRegistered(NC4CLASS)) {
        try {
            // register before H5Iosp
            NetcdfFile.registerIOProvider(NC4CLASS, false);
            Nc4Iosp.setLibraryAndPath(null, null); // use defaults
        } catch (Throwable e) {
            DapLog.error("Cant load IOSP Nc4Iosp");
            throw new DapException(e.getMessage(), e.getCause());
        }
    }
}

From source file:daveayan.gherkinsalad.browser.factory.HtmlUnitBrowser.java

public WebDriver getDriver() {
    try {//from   w  w  w  .  java 2 s . co  m
        HtmlUnitDriver driver = new HtmlUnitDriver();
        driver.setJavascriptEnabled(true);
        return driver;
    } catch (Throwable th) {
        log.info(th.getMessage());
    }
    return new NullWebDriver();
}

From source file:daveayan.gherkinsalad.browser.factory.FireFoxBrowser.java

public WebDriver getDriver() {
    try {//from  w  w  w .  j  a  va 2s .c om
        ReportFactory.reporter().action("Opening Firefox");
        WebDriver driver = new FirefoxDriver();
        return driver;
    } catch (Throwable th) {
        log.info(th.getMessage());
    }
    return new NullWebDriver();
}

From source file:com.caronic.data.redis.SampleRedisApplicationTests.java

private boolean redisServerRunning(Throwable ex) {
    System.out.println(ex.getMessage());
    if (ex instanceof RedisConnectionFailureException) {
        return false;
    }//from   w  w  w. j  ava2 s . c o m
    return (ex.getCause() == null || redisServerRunning(ex.getCause()));
}

From source file:de.ebf.aopspringdemo.camera.CameraAspect_90.java

@Around("within(de.ebf.aopspringdemo.camera.*)")
public void onWithinCameraPackageAround(ProceedingJoinPoint proceedingJoinPoint) {
    Utilities.writeToConsole("within camera package, before...");
    try {/*w  w w .j  a v  a2 s . c  o  m*/
        proceedingJoinPoint.proceed();
    } catch (Throwable throwable) {
        Utilities.writeToConsole(throwable.getMessage());
    }
    Utilities.writeToConsole("within camera package, after...");
}

From source file:ee.ria.xroad.proxy.clientproxy.ClientException.java

ClientException(String faultCode, Throwable cause) {
    super(faultCode, cause.getMessage());

    faultDetail = ExceptionUtils.getStackTrace(cause);

    // All the client messages have prefix Client...
    withPrefix(ErrorCodes.CLIENT_X);/*from ww w . jav  a  2 s  . c  o m*/
}

From source file:ch.rasc.s4ws.portfolio.web.PortfolioController.java

@MessageExceptionHandler
@SendToUser("/queue/errors")
public String handleException(Throwable exception) {
    return exception.getMessage();
}

From source file:com.net2plan.gui.utils.viewEditTopolTables.specificTables.AdvancedJTable_node.java

private static TableModel createTableModel(final IVisualizationCallback callback) {
    //       final TopologyPanel topologyPanel = callback.getTopologyPanel();
    TableModel nodeTableModel = new ClassAwareTableModel(new Object[1][netPlanViewTableHeader.length],
            netPlanViewTableHeader) {/*from w ww .  j  a v a2s  .  c o  m*/
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            if (!callback.getVisualizationState().isNetPlanEditable())
                return false;
            if (columnIndex >= netPlanViewTableHeader.length)
                return true;
            if (getValueAt(rowIndex, columnIndex) == null)
                return false;

            return columnIndex == COLUMN_SHOWHIDE || columnIndex == COLUMN_NAME || columnIndex == COLUMN_STATE
                    || columnIndex == COLUMN_XCOORD || columnIndex == COLUMN_YCOORD;
        }

        @Override
        public void setValueAt(Object newValue, int row, int column) {
            //            System.out.println ("set Value node, newValue: " + newValue + ", row: " + row + ", col: " + column);
            Object oldValue = getValueAt(row, column);

            /* If value doesn't change, exit from function */
            if (newValue != null && newValue.equals(oldValue))
                return;

            NetPlan netPlan = callback.getDesign();

            if (getValueAt(row, 0) == null)
                row = row - 1;
            final long nodeId = (Long) getValueAt(row, 0);
            final Node node = netPlan.getNodeFromId(nodeId);
            /* Perform checks, if needed */
            //            System.out.println ("set Value node: " + node + ", newValue: " + newValue + ", row: " + row + ", col: " + column);
            try {
                switch (column) {
                case COLUMN_SHOWHIDE:
                    if (newValue == null)
                        return;
                    callback.getVisualizationState().setMandatedByTheUserToBeHiddenInCanvas(node,
                            !((Boolean) newValue));
                    callback.getVisualizationState().pickNode(node);
                    callback.updateVisualizationAfterChanges(Sets.newHashSet(NetworkElementType.NODE));
                    callback.getUndoRedoNavigationManager().addNetPlanChange();
                    break;

                case COLUMN_NAME:
                    node.setName(newValue.toString());
                    callback.getVisualizationState().pickNode(node);
                    callback.updateVisualizationAfterChanges(Sets.newHashSet(NetworkElementType.NODE));
                    callback.getUndoRedoNavigationManager().addNetPlanChange();
                    break;

                case COLUMN_STATE:
                    final boolean isNodeUp = (Boolean) newValue;
                    if (callback.getVisualizationState().isWhatIfAnalysisActive()) {
                        final WhatIfAnalysisPane whatIfPane = callback.getWhatIfAnalysisPane();
                        synchronized (whatIfPane) {
                            whatIfPane.whatIfLinkNodesFailureStateChanged(
                                    isNodeUp ? Sets.newHashSet(node) : null,
                                    isNodeUp ? null : Sets.newHashSet(node), null, null);
                            if (whatIfPane.getLastWhatIfExecutionException() != null)
                                throw whatIfPane.getLastWhatIfExecutionException();
                            whatIfPane.wait(); // wait until the simulation ends
                            if (whatIfPane.getLastWhatIfExecutionException() != null)
                                throw whatIfPane.getLastWhatIfExecutionException();

                            final VisualizationState vs = callback.getVisualizationState();
                            Pair<BidiMap<NetworkLayer, Integer>, Map<NetworkLayer, Boolean>> res = vs
                                    .suggestCanvasUpdatedVisualizationLayerInfoForNewDesign(
                                            new HashSet<>(callback.getDesign().getNetworkLayers()));
                            vs.setCanvasLayerVisibilityAndOrder(callback.getDesign(), res.getFirst(),
                                    res.getSecond());
                            callback.updateVisualizationAfterNewTopology();
                        }
                    } else {
                        node.setFailureState(isNodeUp);
                        callback.updateVisualizationAfterChanges(Sets.newHashSet(NetworkElementType.NODE));
                        callback.getVisualizationState().pickNode(node);
                        callback.updateVisualizationAfterPick();
                        callback.getUndoRedoNavigationManager().addNetPlanChange();
                    }
                    break;

                case COLUMN_XCOORD:
                case COLUMN_YCOORD:
                    Point2D newPosition = column == COLUMN_XCOORD
                            ? new Point2D.Double(Double.parseDouble(newValue.toString()),
                                    node.getXYPositionMap().getY())
                            : new Point2D.Double(node.getXYPositionMap().getX(),
                                    Double.parseDouble(newValue.toString()));
                    node.setXYPositionMap(newPosition);
                    callback.updateVisualizationAfterChanges(Sets.newHashSet(NetworkElementType.NODE));
                    callback.getVisualizationState().pickNode(node);
                    callback.updateVisualizationAfterPick();
                    callback.getUndoRedoNavigationManager().addNetPlanChange();
                    break;

                default:
                    break;
                }
            } catch (Throwable ex) {
                ex.printStackTrace();
                ErrorHandling.showErrorDialog(ex.getMessage(), "Error modifying node");
                return;
            }

            /* Set new value */
            super.setValueAt(newValue, row, column);
        }
    };

    return nodeTableModel;
}