Example usage for javax.xml.xpath XPathExpressionException printStackTrace

List of usage examples for javax.xml.xpath XPathExpressionException printStackTrace

Introduction

In this page you can find the example usage for javax.xml.xpath XPathExpressionException printStackTrace.

Prototype

public void printStackTrace(java.io.PrintStream s) 

Source Link

Document

Print stack trace to specified PrintStream .

Usage

From source file:jp.ikedam.jenkins.plugins.viewcopy_builder.SetDescriptionOperation.java

/**
 * @param doc/*from   w w  w .  j  a  v a 2  s  .  c o m*/
 * @param env
 * @param logger
 * @return
 * @see jp.ikedam.jenkins.plugins.viewcopy_builder.ViewcopyOperation#perform(org.w3c.dom.Document, hudson.EnvVars, java.io.PrintStream)
 */
@Override
public Document perform(Document doc, EnvVars env, PrintStream logger) {
    Node descNode;
    try {
        descNode = getNode(doc, "/*/description");
    } catch (XPathExpressionException e) {
        e.printStackTrace(logger);
        return null;
    }

    if (descNode == null) {
        // includeRegex is not exist.
        // create new one.
        descNode = doc.createElement("description");
        doc.getDocumentElement().appendChild(descNode);
    }

    String description = (getDescription() != null) ? StringUtils.trim(env.expand(getDescription())) : "";

    descNode.setTextContent(description);
    logger.println(String.format("Set description to:\n%s", description));

    return doc;
}