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:net.itransformers.topologyviewer.nodetooltip.IntetMapHTMLCSVNodeTooltipTransformer.java

public String transform(String node) {
    try {/*from w ww .j a va2 s  .  c  o  m*/
        StringBuilder sb = new StringBuilder();
        sb.append("<html>");

        for (String key : nodeMetadatas.keySet()) {
            GraphMLMetadata<String> stringGraphMLMetadata = nodeMetadatas.get(key);
            Transformer<String, String> transformer = stringGraphMLMetadata.transformer;
            final String value = transformer.transform(node);
            if (value != null && !key.contains("Prefixes")) {
                sb.append("<p>" + key + ": " + value + "</p>");
            }
        }

        sb.append("</html>");
        return sb.toString().replaceAll("\\[\\]", "");
    } catch (RuntimeException rte) {
        rte.printStackTrace();
        throw rte;
    }
}

From source file:net.itransformers.topologyviewer.nodetooltip.DefaultNodeTooltipTransformer.java

public String transform(String node) {
    try {//  www  .j a  va2 s.  c o m
        StringBuilder sb = new StringBuilder();
        sb.append("<html>");
        sb.append("<p><b>id: " + node + "</b></p>");

        for (String key : nodeMetadatas.keySet()) {
            GraphMLMetadata<String> stringGraphMLMetadata = nodeMetadatas.get(key);
            Transformer<String, String> transformer = stringGraphMLMetadata.transformer;
            final String value = transformer.transform(node);
            if (value != null) {
                sb.append("<p>" + key + ": " + value + "</p>");
            }
        }

        sb.append("</html>");
        return sb.toString().replaceAll("\\[\\]", "");
    } catch (RuntimeException rte) {
        rte.printStackTrace();
        throw rte;
    }
}

From source file:net.itransformers.topologyviewer.nodetooltip.HTMLCSVNodeTooltipTransformer.java

public String transform(String node) {
    try {//from   w ww .  j  a  va  2 s.  c  om
        StringBuilder sb = new StringBuilder();
        sb.append("<html>");
        Set<String> valueSet = new HashSet<String>();
        GraphMLMetadata<String> stringGraphMLMetadata = nodeMetadatas.get(tooltipType.getDataKey());
        if (stringGraphMLMetadata != null) {
            Transformer<String, String> transformer = stringGraphMLMetadata.transformer;
            final String value = transformer.transform(node);
            if (value != null && !sb.toString().contains(value)) {
                sb.append(value);
            }
            sb.append(valueSet);
        }
        sb.append("</html>");
        return sb.toString().replaceAll("\\[\\]", "");
    } catch (RuntimeException rte) {
        rte.printStackTrace();
        throw rte;
    }
}

From source file:org.matsim.contrib.parking.parkingchoice.lib.GeneralLib.java

/**
 * reads in data from a file./*ww  w.  ja va2 s  . c  o m*/
 * 
 * 
 * @param numberOfRows
 * @param numberOfColumns
 * @param ignoreFirstLine
 * @return
 */
public static double[][] readMatrix(int numberOfRows, int numberOfColumns, boolean ignoreFirstLine,
        String fileName) {

    double[][] matrix = new double[numberOfRows][numberOfColumns];

    try {

        FileReader fr = new FileReader(fileName);

        BufferedReader br = new BufferedReader(fr);
        String line;
        StringTokenizer tokenizer;
        String token;

        if (ignoreFirstLine) {
            br.readLine();
        }

        line = br.readLine();
        int rowId = 0;
        while (line != null) {
            tokenizer = new StringTokenizer(line);

            for (int i = 0; i < numberOfColumns; i++) {
                token = tokenizer.nextToken();
                double parsedNumber = Double.parseDouble(token);
                matrix[rowId][i] = parsedNumber;
            }

            if (tokenizer.hasMoreTokens()) {
                // if there are more columns than expected, throw an
                // exception
                throw new RuntimeException("the number of columns is wrong");
            }

            line = br.readLine();
            rowId++;
        }
        if (rowId != numberOfRows) {
            throw new RuntimeException("the number of rows is wrong");
        }

    } catch (RuntimeException e) {
        // just forward the runtime exception
        throw e;
    } catch (Exception e) {
        e.printStackTrace();

        throw new RuntimeException("Error reading the matrix from the file");
    }

    return matrix;
}

From source file:net.itransformers.topologyviewer.edgetooltip.DashEdgeTooltipTransformer.java

public String transform(String edge) {
    try {/*  w ww.  j  ava 2s  .  co  m*/
        StringBuilder sb = new StringBuilder();
        boolean isFirst = true;
        sb.append("<html>");
        GraphMLMetadata<String> stringGraphMLMetadata = edgeMetadatas.get(tooltipType.getDataKey());
        Transformer<String, String> transformer = stringGraphMLMetadata.transformer;
        final String value = transformer.transform(edge);
        if (value != null) {
            if (!isFirst) {
                sb.append("<b> - </b>");
            } else {
                isFirst = false;
            }
            sb.append(value);

        }
        sb.append("</html>");
        return sb.toString();
    } catch (RuntimeException rte) {
        rte.printStackTrace();
        throw rte;
    }
}

From source file:org.fusesource.devoxx.reportincident.service.impl.IncidentServiceImpl.java

public void saveIncident(Incident incident) {

    try {/*from  w  w w.java  2  s.c om*/
        getIncidentDAO().saveIncident(incident);
    } catch (RuntimeException e) {
        e.printStackTrace();
    }

}

From source file:com.microsoft.office.sfb.healthcare.wellbabyreport.java

@OnClick(R.id.fab)
public void onClick() {
    try {//from   w ww .  j  ava2s.c  o  m
        Intent callIntent = new Intent(this, SkypeCall.class);
        startActivity(callIntent);
    } catch (RuntimeException e) {
        e.printStackTrace();
    }

}

From source file:org.apache.camel.example.reportincident.service.impl.IncidentServiceImpl.java

public void saveIncident(Incident incident) {

    try {//from   ww  w  .  j a  v  a  2 s. c om
        getIncidentDAO().saveIncident(incident);
        throw new RuntimeException(">> Generate Error to simulate RollBack");
    } catch (RuntimeException e) {
        e.printStackTrace();
    }

}

From source file:it.unimi.di.big.mg4j.query.InputStreamItem.java

protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException {
    try {/*w  w w .ja v a2s  . co  m*/
        if (request.getParameter("m") != null && request.getParameter("doc") != null) {
            DocumentCollection collection = (DocumentCollection) getServletContext().getAttribute("collection");
            if (collection == null)
                LOGGER.error("The servlet context does not contain a document collection.");
            response.setContentType(request.getParameter("m"));
            response.setCharacterEncoding("UTF-8");
            InputStream rawContent = collection.stream(Long.parseLong(request.getParameter("doc")));
            for (int i = skip; i-- != 0;)
                rawContent.reset();
            IOUtils.copy(rawContent, response.getOutputStream());
        }
    } catch (RuntimeException e) {
        e.printStackTrace();
        LOGGER.error(e.toString());
        throw e;
    }
}

From source file:net.itransformers.topologyviewer.edgetooltip.HTMLCSVEdgeTooltipTransformer.java

public String transform(String edge) {
    try {//from   w ww.ja  v  a  2 s  .com
        StringBuilder sb = new StringBuilder();
        sb.append("<html>");
        Set<String> valueSet = new HashSet<String>();
        GraphMLMetadata<String> stringGraphMLMetadata = edgeMetadatas.get(tooltipType.getDataKey());
        if (stringGraphMLMetadata == null) {
            logger.error("Unable find tooltip edgeMetadata for key: " + tooltipType.getDataKey());
            return "";
        }
        Transformer<String, String> transformer = stringGraphMLMetadata.transformer;
        final String value = transformer.transform(edge);
        if (value != null && !sb.toString().contains(value)) {
            sb.append(value);
        }
        sb.append(valueSet);

        sb.append("</html>");
        return sb.toString().replaceAll("\\[\\]", "");
    } catch (RuntimeException rte) {
        rte.printStackTrace();
        throw rte;
    }
}