Example usage for java.io UnsupportedEncodingException printStackTrace

List of usage examples for java.io UnsupportedEncodingException printStackTrace

Introduction

In this page you can find the example usage for java.io UnsupportedEncodingException printStackTrace.

Prototype

public void printStackTrace(PrintStream s) 

Source Link

Document

Prints this throwable and its backtrace to the specified print stream.

Usage

From source file:com.iflytek.spider.util.DomUtil.java

/**
 * save dom into ouputstream//from   w  w  w. ja  v a  2s.c  om
 * 
 * @param os
 * @param e
 */
public static void saveDom(OutputStream os, Element e) {

    DOMSource source = new DOMSource(e);
    TransformerFactory transFactory = TransformerFactory.newInstance();
    Transformer transformer;
    try {
        transformer = transFactory.newTransformer();
        transformer.setOutputProperty("indent", "yes");
        StreamResult result = new StreamResult(os);
        transformer.transform(source, result);
        os.flush();
    } catch (UnsupportedEncodingException e1) {
        e1.printStackTrace(LogUtil.getWarnStream(LOG));
    } catch (IOException e1) {
        e1.printStackTrace(LogUtil.getWarnStream(LOG));
    } catch (TransformerConfigurationException e2) {
        e2.printStackTrace(LogUtil.getWarnStream(LOG));
    } catch (TransformerException ex) {
        ex.printStackTrace(LogUtil.getWarnStream(LOG));
    }
}

From source file:com.pureinfo.studio.db.cmd2srm.ref.impl.ChangeFormatter.java

public Object convert(DolphinObject _old, DolphinObject _new, String _sFromProperty, String _sToProperty,
        ISession _fromSession, ISession _toSession, EntityMetadata _metadata, String _sKey, String _sToTable)
        throws PureException {

    String sNew = null;//w  w w.  ja  v  a2 s .  c om
    try {
        String sProjectModel = _old.getStrProperty(_sFromProperty);
        String[] formatter = sProjectModel.split(",");
        String[] result = new String[formatter.length];
        sNew = null;

        if (formatter.length == 1) {
            sNew = this.getListNamedValue(220, sProjectModel);
        } else {
            for (int i = 0; i < formatter.length; i++) {
                logger.debug(formatter[i]);
                result[i] = this.getListNamedValue(220, formatter[i]);
                logger.debug(">>>>>>>>>>>>>" + result[i]);
            }

            for (int i = 0; i < result.length; i++) {
                if (i == 0) {
                    sNew = result[0];
                } else {
                    sNew = sNew + "$" + result[i];
                }
            }
        }
    } catch (UnsupportedEncodingException ex) {
        ex.printStackTrace(System.err);
    }
    logger.debug(sNew);
    return sNew;
}