Example usage for java.lang RuntimeException printStackTrace

List of usage examples for java.lang RuntimeException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

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

Usage

From source file:com.predic8.plugin.membrane_client.tabcomposites.MessageTabManager.java

public void copyBodyFromGUIToModel() {
    try {//from ww w.  j a va 2  s.co  m
        baseComp.getMsg().setBodyContent(getBodyText().getBytes());
        log.debug("Body copied from GUI to model");
    } catch (RuntimeException e) {
        e.printStackTrace();
    }
}

From source file:edu.umn.cs.spatialHadoop.core.JTSShape.java

@Override
public void fromText(Text text) {
    // Read and skip a long
    //    TextSerializerHelper.consumeLong(text, '\t');
    try {/*from  w  w  w .  j ava 2 s.co  m*/
        // Check whether this text is a Well Known Text (WKT) or a hexed string
        boolean wkt = false;
        byte[] bytes = text.getBytes();
        int length = text.getLength();
        int i_shape = 0;
        while (!wkt && i_shape < ShapeNames.length) {
            byte[] shapeName = ShapeNames[i_shape];
            if (length > shapeName.length) {
                int i = 0;
                while (i < shapeName.length && shapeName[i] == bytes[i])
                    i++;
                if (i == shapeName.length) {
                    wkt = true;
                    break;
                }
            }
            i_shape++;
        }

        // Look for the terminator of the shape text
        byte terminator = Separator[0];
        int i1 = 0;
        if (bytes[i1] == '\'' || bytes[i1] == '\"') {
            terminator = bytes[i1++];
        }
        int i2 = i1;
        while (i2 < length && bytes[i2] != terminator)
            i2++;

        String str = new String(bytes, i1, i2 - i1);
        geom = parseText(str);

        if (++i2 < length) {
            extra = new String(bytes, i2, length - i2);
        } else {
            extra = null;
        }
    } catch (RuntimeException e) {
        LOG.error("Error parsing: " + text);
        throw e;
    } catch (ParseException e) {
        LOG.error("Error parsing: " + text);
        e.printStackTrace();
    }
}

From source file:net.sourceforge.pmd.ant.PMDTask.java

private void handleError(RuleContext ctx, Report errorReport, RuntimeException pmde) {

    pmde.printStackTrace();
    log(pmde.toString(), Project.MSG_VERBOSE);

    Throwable cause = pmde.getCause();

    if (cause != null) {
        StringWriter strWriter = new StringWriter();
        PrintWriter printWriter = new PrintWriter(strWriter);
        cause.printStackTrace(printWriter);
        log(strWriter.toString(), Project.MSG_VERBOSE);
        IOUtils.closeQuietly(printWriter);

        if (StringUtil.isNotEmpty(cause.getMessage())) {
            log(cause.getMessage(), Project.MSG_VERBOSE);
        }//from w w w .  j  a  v a 2 s  .com
    }

    if (failOnError) {
        throw new BuildException(pmde);
    }
    errorReport.addError(new Report.ProcessingError(pmde.getMessage(), ctx.getSourceCodeFilename()));
}

From source file:org.kalypso.kalypsomodel1d2d.ui.map.temsys.ShowEditWindDataWidget.java

private final void paintWindDataTooltip(final Graphics g, final Point p) {
    if (m_widgetFace.isAnimating()) {

        return;//  w  w  w.ja v a  2 s  . co m
    }
    final Color color = g.getColor();
    g.setColor(Color.BLACK);
    try {
        if (p == null)
            return;

        final IMapPanel mapPanel = m_dataModel.getMapPanel();
        if (mapPanel == null || mapPanel.getProjection() == null)
            return;

        final GM_Point nodePoint = MapUtilities.transform(mapPanel, p);

        final StringBuffer tooltipText = new StringBuffer();

        final IWindDataProvider windProvider = m_dataModel.getWindDataModel();
        if (windProvider != null && nodePoint != null) {
            final Pair<Double, Double> wind1 = windProvider.getWindAsVector(nodePoint);

            final Pair<Double, Double> wind = NativeWindDataModelHelper
                    .convertVectorWindToSpeedAndDirection(wind1);
            if (wind != null && !Double.isNaN(wind.first) && !Double.isNaN(wind.second)) {
                tooltipText.append(Messages
                        .getString("org.kalypso.kalypsomodel1d2d.ui.map.temsys.ShowEditWindDataWidget.3")); //$NON-NLS-1$
                tooltipText.append(String.format(": %.3f m/s %.3f deg ", wind.first, wind.second)); //$NON-NLS-1$
                tooltipText.append(String.format("; %.3f U %.3f V ", wind1.first, wind1.second)); //$NON-NLS-1$
            } else
                tooltipText.append(Messages
                        .getString("org.kalypso.kalypsomodel1d2d.ui.map.temsys.ShowEditWindDataWidget.4")); //$NON-NLS-1$
        } else
            tooltipText.append(
                    Messages.getString("org.kalypso.kalypsomodel1d2d.ui.map.temsys.ShowEditWindDataWidget.4")); //$NON-NLS-1$

        m_toolTipRenderer.setTooltip(tooltipText.toString());
        m_toolTipRenderer.paintToolTip(p, g, getMapPanel().getScreenBounds());

        return;
    } catch (final RuntimeException e) {
        e.printStackTrace();
    } finally {
        g.setColor(color);
    }
}

From source file:com.exalttech.trex.ui.controllers.daemon.TRexDaemonDialogController.java

private void tryToConnect() {
    initJsonRpcClient();/*from  ww  w. j  a v  a 2s. co m*/
    boolean connected = false;
    try {
        connected = client.createRequest().id(getId()).method("connectivity_check").returnAs(Boolean.class)
                .execute();
    } catch (RuntimeException ex) {
        ex.printStackTrace();
    }

    if (connected) {
        log(LogType.INFO,
                MessageFormat.format("Connection to http://{0}:{1} established", getHostname(), getPort()));
        getMetadata();
    } else {
        this.client = null;
        log(LogType.ERROR, MessageFormat.format("Unable to access http://{0}:{1} requested host and port",
                getHostname(), getPort()));
    }
    refreshControlsAvailability();
}

From source file:org.pantsbuild.tools.junit.impl.XmlReportTest.java

protected File runTestAndReturnXmlFile(String testClassName, boolean shouldFail)
        throws IOException, JAXBException {
    String outdirPath = temporary.newFolder("testOutputDir").getAbsolutePath();

    String args = Joiner.on(" ").join(testClassName, "-xmlreport", "-outdir", outdirPath);
    // run through asArgsArray so that we always tack on parameterized test arguments
    if (shouldFail) {
        try {//  w  w w.jav  a2 s.c  o m
            invokeConsoleRunner(args);
            fail("The ConsoleRunner should throw an exception when running these tests");
        } catch (RuntimeException ex) {
            // Expected
            ex.printStackTrace();
        }
    } else {
        invokeConsoleRunner(args);
    }

    return new File(outdirPath, "TEST-" + testClassName + ".xml");
}

From source file:com.exalttech.trex.ui.controllers.daemon.TRexDaemonDialogController.java

private void getMetadata() {
    try {/*  w  ww  .  ja  v  a 2s  .c om*/
        metadata = client.createRequest().id(getId()).method("get_trex_config_metadata")
                .returnAs(new TypeReference<List<MetaField>>() {
                }).execute();
    } catch (RuntimeException ex) {
        ex.printStackTrace();
        log(LogType.ERROR, "Unable to get TRex config Metadata, custom config usage will not be available: "
                + ex.getMessage());
        return;
    }

    try {
        interfacesInfo = client.createRequest().id(getId()).method("get_devices_info")
                .returnAs(new TypeReference<Map<String, InterfaceInfo>>() {
                }).execute();
        TrexApp.injector.getInstance(InterfaceInfoProvider.class).setInterfacesInfo(interfacesInfo);
    } catch (Exception ex) {
        ex.printStackTrace();
        log(LogType.ERROR, "Unable to get TRex devices info, interface selection dialog will not be available: "
                + ex.getMessage());
    }

    initUserConfigModel();
    initConfigTree();
    updateYAML();
}

From source file:xiaofei.library.datastorage.database.DbCache.java

private DbCache(Context context) {
    mExecutorService = Executors.newSingleThreadExecutor();
    mCache = new HashMap<String, Map<String, Object>>();
    try {/* www. j a v  a  2 s.co  m*/
        mDatabase = DbService.getInstance(context);
    } catch (RuntimeException e) {
        e.printStackTrace();
        mDatabase = null;
    }
    mAnnotationProcessor = AnnotationProcessor.getInstance();
}

From source file:gov.nih.nci.caintegrator.application.download.carray23.CaArrayFileDownloader.java

/**
 * Select all chp data files associated with the given samples.
 * @throws InvalidInputException //from  w w w  .j a  v  a 2  s  .  co  m
 */
private List<gov.nih.nci.caarray.external.v1_0.data.File> selectChpFilesFromSamples(
        SearchApiUtils searchServiceHelper, CaArrayEntityReference experimentRef,
        Set<CaArrayEntityReference> sampleRefs) throws RemoteException, InvalidInputException {
    FileSearchCriteria fileSearchCriteria = new FileSearchCriteria();
    fileSearchCriteria.setExperiment(experimentRef);
    fileSearchCriteria.setExperimentGraphNodes(sampleRefs);
    fileSearchCriteria.getCategories().add(FileCategory.DERIVED_DATA);
    fileSearchCriteria.setExtension("CHP");

    List<gov.nih.nci.caarray.external.v1_0.data.File> files = null;
    try {
        files = searchServiceHelper.filesByCriteria(fileSearchCriteria).list();
    } catch (RuntimeException e) {
        reportError(e.getMessage(), e);
        e.printStackTrace();
        throw e;
    }
    if (files != null && files.size() <= 0) {
        return null;
    }

    return files;
}

From source file:gov.nih.nci.caintegrator.application.download.carray23.CaArrayFileDownloader.java

/**
 * Select all raw data files associated with the given samples.
 * @throws InvalidInputException /*  w w w .  j ava 2 s  . c o m*/
 */
private List<gov.nih.nci.caarray.external.v1_0.data.File> selectCelFilesFromSamples(
        SearchApiUtils searchServiceHelper, CaArrayEntityReference experimentRef,
        Set<CaArrayEntityReference> sampleRefs) throws RemoteException, InvalidInputException {
    FileSearchCriteria fileSearchCriteria = new FileSearchCriteria();
    fileSearchCriteria.setExperiment(experimentRef);
    fileSearchCriteria.setExperimentGraphNodes(sampleRefs);
    fileSearchCriteria.getCategories().add(FileCategory.RAW_DATA);
    fileSearchCriteria.setExtension("CEL");

    List<gov.nih.nci.caarray.external.v1_0.data.File> files = null;
    try {
        files = searchServiceHelper.filesByCriteria(fileSearchCriteria).list();
    } catch (RuntimeException e) {
        reportError(e.getMessage(), e);
        e.printStackTrace();
        throw e;
    }

    if (files != null && files.size() <= 0) {
        return null;
    }

    return files;
}