Example usage for org.apache.commons.jxpath JXPathNotFoundException getMessage

List of usage examples for org.apache.commons.jxpath JXPathNotFoundException getMessage

Introduction

In this page you can find the example usage for org.apache.commons.jxpath JXPathNotFoundException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Return the message (if any) for this error .

Usage

From source file:com.opera.core.systems.scope.AbstractService.java

/**
 * Query a collection with JXPath and return value of node
 *
 * @param collection/*from w w  w.  j  a  v a  2  s .  c o m*/
 * @param query a valid XPath query
 * @return result
 */
public Object xpathQuery(Collection<?> collection, String query) {
    JXPathContext pathContext = JXPathContext.newContext(collection);
    Object result = null;
    try {
        result = pathContext.getValue(query);
    } catch (JXPathNotFoundException e) {
        logger.log(Level.WARNING, "JXPath exception: {0}", e.getMessage());
    }
    return result;
}

From source file:com.opera.core.systems.scope.AbstractService.java

/**
 * Query a collection JXPath and return a pointer FIXME: This does not belong
 * here!/*ww w.j a v a 2 s. c  o m*/
 *
 * @param collection
 * @param query
 * @return Pointer to node
 */
public Pointer xpathPointer(Collection<?> collection, String query) {
    JXPathContext pathContext = JXPathContext.newContext(collection);
    Pointer result = null;
    try {
        result = pathContext.getPointer(query);
    } catch (JXPathNotFoundException e) {
        logger.log(Level.WARNING, "JXPath exception: {0}", e.getMessage());
    }
    return result;
}

From source file:com.opera.core.systems.scope.AbstractService.java

/**
 * Query a collection JXPath and return a pointer FIXME: This does not belong
 * here!//from  w  w  w . ja v  a2s .  co  m
 *
 * @param collection
 * @param query
 * @return Pointer to node
 */
public Iterator<?> xpathIterator(Collection<?> collection, String query) {
    JXPathContext pathContext = JXPathContext.newContext(collection);
    Iterator<?> result = null;
    try {
        result = pathContext.iteratePointers(query);
    } catch (JXPathNotFoundException e) {
        logger.log(Level.WARNING, "JXPath exception: {0}", e.getMessage());
    }
    return result;
}

From source file:org.apache.camel.language.jxpath.JXPathFilterNotLenientTest.java

@Test
public void testNotLenient() throws Exception {
    getMockEndpoint("mock:result").expectedMessageCount(0);

    try {/*from www. ja va 2 s.  c o  m*/
        template.sendBody("direct:start", new PersonBean("James", "London"));
        fail("Should have thrown exception");
    } catch (Exception e) {
        JXPathNotFoundException cause = assertIsInstanceOf(JXPathNotFoundException.class,
                e.getCause().getCause());
        assertEquals("No value for xpath: in/body/name2", cause.getMessage());
    }

    assertMockEndpointsSatisfied();
}