Package xbird.xquery

Examples of xbird.xquery.DynamicError


                    final Item groupKey;
                    if(atomizedItor.hasNext()) {
                        AtomicValue atom = (AtomicValue) atomizedItor.next();
                        if(atomizedItor.hasNext()) {
                            atomizedItor.closeQuietly();
                            throw new DynamicError("err:XQDY0095", "Illegal resulting value for a grouping variable: "
                                    + atomized);
                        }
                        groupKey = atom.asGroupingValue();
                    } else {
                        groupKey = ValueSequence.EMPTY_SEQUENCE;
View Full Code Here


        }

        public void putNonGroupingVariable(BindingVariable var) throws DynamicError {
            final Sequence result = var.getResult();
            if(result == null) {
                throw new DynamicError("Result is not bounded for " + var);
            }
            if(nonGroupingVaribales == null) {
                this.nonGroupingVaribales = new IdentityHashMap<BindingVariable, Sequence>(4);
                nonGroupingVaribales.put(var, result);
            } else {
View Full Code Here

        }
        final Reader fis;
        try {
            fis = new FileReader(_queryFile);
        } catch (FileNotFoundException e) {
            throw new DynamicError("Illegal Query file: " + path, e);
        }
        execute(fis, _timeout);
    }
View Full Code Here

        final Writer writer;
        if(_out != null) {
            try {
                writer = new FastBufferedWriter(new OutputStreamWriter(new FileOutputStream(_out), _encoding), 8192);
            } catch (IOException e) {
                throw new DynamicError("Illegal Output file: " + e.getMessage());
            }
        } else {
            writer = new FastBufferedWriter(new OutputStreamWriter(System.out, Charset.forName(_encoding)), 4096);
        }
View Full Code Here

    }

    public static XsDuration valueOf(String literal) throws XQueryException {
        final Matcher match = DURATION_PATTERN.matcher(literal);
        if(!match.matches()) {
            throw new DynamicError("err:FORG0001", "Illegal representation as xs:duration: "
                    + literal);
        }

        final String y, mo, d;
        int year = ((y = match.group(2)) == null) ? 0 : Integer.parseInt(y);
View Full Code Here

        if(argv == null) {
            // If the function is called without an argument, the context item is used
            // as the default argument.
            Item i = dynEnv.contextItem();
            if(i == null) {
                throw new DynamicError("err:XPDY0002", "ContextItem is not set");
            }
            if(i instanceof XQNode) {
                ((XQNode) i).getRoot();
            } else {
                throw new DynamicError("err:XPTY0004", "context item is not a node");
            }
        } else if(argv.size() == 1) {
            Item i = argv.getItem(0);
            if(i.isEmpty()) {
                return ValueSequence.EMPTY_SEQUENCE;
            }
            if(i instanceof XQNode) {
                return ((XQNode) i).getRoot();
            }
        }
        throw new DynamicError("Arguments size of " + SYMBOL + " must be 0 or 1, but was "
                + argv.size());
    }
View Full Code Here

        assert (arglen == 1 || arglen == 2);
        final XQNode node;
        if (arglen == 1) {
            Item contextItem = dynEnv.contextItem();
            if (contextItem == null) {
                throw new DynamicError("err:XPDY0002", "ContextItem is not set");
            }
            if (!(contextItem instanceof XQNode)) {
                throw new DynamicError("err:XPTY0004", "Context item is expected to node, but was "
                        + contextItem.getType());
            }
            node = (XQNode) contextItem;
        } else {
            Item secondItem = argv.getItem(1);
View Full Code Here

        public XDouble eval(DynamicContext dynEnv, Item v1, Item v2) throws XQueryException {
            double d1 = asDouble(v1, dynEnv);
            double d2 = asDouble(v2, dynEnv);
            final double res = d1 % d2;
            if(res == Double.POSITIVE_INFINITY) {
                throw new DynamicError("err:FOAR0002", "result overflow");
            }
            if(res == Double.NEGATIVE_INFINITY) {
                throw new DynamicError("err:FOAR0002", "result underflow");
            }
            return XDouble.valueOf(res);
        }
View Full Code Here

        static final ModDecimal INSTANCE = new ModDecimal();

        public XDecimal eval(DynamicContext dynEnv, Item v1, Item v2) throws XQueryException {
            final BigDecimal divisor = asDecimal(v2, dynEnv);
            if(divisor.equals(BigDecimal.ZERO)) {
                throw new DynamicError("err:FOAR0001", "mod by zero");
            }
            BigDecimal bd1 = asDecimal(v1, dynEnv);
            BigDecimal res = bd1.remainder(divisor); // result may be negative
            return XDecimal.valueOf(res);
        }
View Full Code Here

            }
        }
    }

    private static XQRTException wrapSAXException(SAXException ex) throws DynamicError {
        throw new DynamicError("Writing SAX event failed", ex);
    }
View Full Code Here

TOP

Related Classes of xbird.xquery.DynamicError

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.