Example usage for javax.xml.xpath XPathException getMessage

List of usage examples for javax.xml.xpath XPathException getMessage

Introduction

In this page you can find the example usage for javax.xml.xpath XPathException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.fcrepo.mint.HttpPidMinter.java

/**
 * Create a new HttpPidMinter.//from  ww  w.j ava 2s.c  om
 * @param url The URL for the minter service.  This is the only required argument -- all
 *    other parameters can be blank.
 * @param method The HTTP method (POST, PUT or GET) used to generate a new PID (POST will
 *    be used if the method is blank.
 * @param username If not blank, use this username to connect to the minter service.
 * @param password If not blank, use this password used to connect to the minter service.
 * @param regex If not blank, use this regular expression used to remove unwanted text from the
 *    minter service response.  For example, if the response text is "/foo/bar:baz" and the
 *    desired identifier is "baz", then the regex would be ".*:".
 * @param xpath If not blank, use this XPath expression used to extract the desired identifier
 *    from an XML minter response.
**/
public HttpPidMinter(final String url, final String method, final String username, final String password,
        final String regex, final String xpath) {

    if (isBlank(url)) {
        throw new IllegalArgumentException("Minter URL must be specified!");
    }

    this.url = url;
    this.method = (method == null ? "post" : method);
    this.username = username;
    this.password = password;
    this.regex = regex;
    if (!isBlank(xpath)) {
        try {
            this.xpath = XPathFactory.newInstance().newXPath().compile(xpath);
        } catch (final XPathException ex) {
            LOGGER.warn("Error parsing xpath ({}): {}", xpath, ex.getMessage());
            throw new IllegalArgumentException("Error parsing xpath" + xpath, ex);
        }
    }
    this.client = buildClient();
}