Package org.apache.commons.jxpath

Examples of org.apache.commons.jxpath.JXPathException


  /*
   * Check if the result is of the specified type
   */
  private void assertResultType(Exchange exchange, Object result) {
    if (!type.isAssignableFrom(result.getClass())) {
      throw new JXPathException("JXPath result type is " + result.getClass() + " instead of required type " + type);
    }
  }
View Full Code Here


        return name;
    }

    public Object getBaseValue() {
        if (!actual) {
            throw new JXPathException("Undefined variable: " + name);
        }
        return variables.getVariable(name.toString());
    }
View Full Code Here

                : ValueUtils.getValue(value, index);
    }

    public void setValue(Object value) {
        if (!actual) {
            throw new JXPathException("Cannot set undefined variable: " + name);
        }
        valuePointer = null;
        if (index != WHOLE_COLLECTION) {
            Object collection = getBaseValue();
            ValueUtils.setValue(collection, index, value);
View Full Code Here

                    NodePointer.newChildNodePointer(this, null, value);
            }
            else {
                return new NullPointer(this, getName()) {
                    public Object getImmediateNode() {
                        throw new JXPathException(
                            "Undefined variable: " + name);
                    }
                };
            }
        }
View Full Code Here

            NamespaceResolver nsr = getNamespaceResolver();
            if (nsr != null) {
                ns = nsr.getNamespaceURI(prefix);
            }
            if (ns == null) {
                throw new JXPathException(
                    "Unknown namespace prefix: " + prefix);
            }
            element.setAttributeNS(ns, name.toString(), "");
        }
        else {
View Full Code Here

    }

    public void remove() {
        Node parent = node.getParentNode();
        if (parent == null) {
            throw new JXPathException("Cannot remove root DOM node");
        }
        parent.removeChild(node);
    }
View Full Code Here

        HttpSession session = handle.getSession();
        if (session != null) {
            session.setAttribute(property, value);
        }
        else {
            throw new JXPathException("Cannot set session attribute: "
                    + "there is no session");
        }
    }
View Full Code Here

        }
        if (value instanceof NodePointer) {
            value = ((NodePointer) value).getValue();
        }
        if (value == null) {
            throw new JXPathException("Predicate value is null: " + predicate);
        }

        if (value instanceof Number) {
            final double round = 0.5;
            return (int) (InfoSetUtil.doubleValue(value) + round) - 1;
View Full Code Here

        Element element = (Element) node;
        String prefix = name.getPrefix();
        if (prefix != null) {
            String namespaceUri = getNamespaceResolver().getNamespaceURI(prefix);
            if (namespaceUri == null) {
                throw new JXPathException(
                    "Unknown namespace prefix: " + prefix);
            }
            Namespace ns = Namespace.getNamespace(prefix, namespaceUri);
            Attribute attr = element.getAttribute(name.getName(), ns);
            if (attr == null) {
View Full Code Here

    }

    public void remove() {
        Element parent = nodeParent(node);
        if (parent == null) {
            throw new JXPathException("Cannot remove root JDOM node");
        }
        parent.getContent().remove(node);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jxpath.JXPathException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.