Package org.exist.xquery

Examples of org.exist.xquery.XPathException


            else if ("NaN".equals(stringValue))
                {value = Float.NaN;}
      else
        {value = Float.parseFloat(stringValue);}
    } catch (final NumberFormatException e) {
      throw new XPathException(ErrorCodes.FORG0001, "cannot construct "
                                     + Type.getTypeName(this.getItemType())
                                     + " from \""
                                     + getStringValue()
                                     + "\"");         
    }
View Full Code Here


      case Type.UNSIGNED_BYTE :
      case Type.POSITIVE_INTEGER :
        if (!(Float.isInfinite(value) || Float.isNaN(value)))
          {return new IntegerValue((long) value, requiredType);}
        else
          {throw new XPathException(ErrorCodes.FOCA0002, "cannot convert ' xs:float(\""
                                             + getStringValue()
                                             + "\")' to "
                                             + Type.getTypeName(requiredType));}
      case Type.BOOLEAN :
        return (value == 0.0f || Float.isNaN(value))
          ? BooleanValue.FALSE
          : BooleanValue.TRUE;
      case Type.UNTYPED_ATOMIC :
        return new UntypedAtomicValue(getStringValue());
      default :
        throw new XPathException(ErrorCodes.FORG0001, "cannot cast '"
                                         + Type.getTypeName(this.getItemType())
                                         + "(\""
                                         + getStringValue()
                                         + "\")' to "
                                         + Type.getTypeName(requiredType));
View Full Code Here

    } else if (target == String.class)
      {return (T)getStringValue();}
    else if (target == Boolean.class)
      {return (T)Boolean.valueOf(effectiveBooleanValue());}

    throw new XPathException(
      "cannot convert value of type "
        + Type.getTypeName(getType())
        + " to Java object of type "
        + target.getName());
  }
View Full Code Here

    }

    public Sequence eval( Sequence[] args, Sequence contextSequence ) throws XPathException
    {
        if(!context.getEffectiveUser().hasDbaRole()) {
            throw new XPathException("You must be a DBA to list available backups");
        }

        final String exportDir = args[0].getStringValue();
        File   dir       = new File( exportDir );
View Full Code Here

            }
        } else if(isCalledAs(qnUri.getLocalName())) {
            result = new StringValue(request.getURI());
           
        } else {
            throw new XPathException(this, "Unknown function call: " + getSignature());
        }
       
        return result;
    }
View Full Code Here

    @Override
    public final Sequence eval(final Sequence[] args, final Sequence contextSequence) throws XPathException {
        final HttpRequest request = (HttpRequest)getContext().getAttribute(RequestModule.EXQ_REQUEST_ATTR);
        if(request == null) {
            throw new XPathException(this, "The HTTP Request is not defined in the Dynamic Context");
        }
       
        return eval(args, request);
    }
View Full Code Here

        } else if(isCalledAs(qnRemotePort.getLocalName())) {
            result = new IntegerValue(request.getRemotePort());
              
        } else {
            throw new XPathException(this, "Unknown function call: " + getSignature());
        }
       
        return result;
    }
View Full Code Here

    if (other.isEmpty())
      {return false;}
    final int r = compareTo(collator, other)
    if (operator != Constants.EQ && operator != Constants.NEQ){
      if (getType() == Type.DURATION)
        {throw new XPathException(ErrorCodes.XPTY0004,
            "cannot compare unordered " + Type.getTypeName(getType()) + " to "
            + Type.getTypeName(other.getType()));}
      if (other.getType()== Type.DURATION)
        {throw new XPathException(ErrorCodes.XPTY0004,
          "cannot compare " + Type.getTypeName(getType()) + " to unordered "
          + Type.getTypeName(other.getType()));}
      if (Type.getCommonSuperType(getType(), other.getType()) == Type.DURATION)
        {throw new XPathException(ErrorCodes.XPTY0004,
          "cannot compare " + Type.getTypeName(getType()) + " to "
          + Type.getTypeName(other.getType()));}
    }
    switch (operator) {
      case Constants.EQ :
        return r == DatatypeConstants.EQUAL;
      case Constants.NEQ :
        return r != DatatypeConstants.EQUAL;
      case Constants.LT :
        return r == DatatypeConstants.LESSER;
      case Constants.LTEQ :
        return r == DatatypeConstants.LESSER || r == DatatypeConstants.EQUAL;
      case Constants.GT :
        return r == DatatypeConstants.GREATER;
      case Constants.GTEQ :
        return r == DatatypeConstants.GREATER || r == DatatypeConstants.EQUAL;
      default :
        throw new XPathException("Unknown operator type in comparison");
    }
  }
View Full Code Here

            Constants.INFERIOR : Constants.SUPERIOR;
      }
      if (r == DatatypeConstants.INDETERMINATE) {throw new RuntimeException("indeterminate order between totally ordered duration values " + this + " and " + other);}
      return r;   
    }
    throw new XPathException(
        "Type error: cannot compare " + Type.getTypeName(getType()) + " to "
        + Type.getTypeName(other.getType()));
  }
View Full Code Here

        "Type error: cannot compare " + Type.getTypeName(getType()) + " to "
        + Type.getTypeName(other.getType()));
  }

  public AtomicValue max(Collator collator, AtomicValue other) throws XPathException {
    if (other.getType() != getType()) {throw new XPathException("cannot obtain maximum across different non-numeric data types");}
    return compareTo(null, other) > 0 ? this : other;
  }
View Full Code Here

TOP

Related Classes of org.exist.xquery.XPathException

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.