Examples of DynamicError


Examples of xbird.xquery.DynamicError

            normed = Normalizer.normalize(arg, Normalizer.NFKC);
        } else if("NFKD".equalsIgnoreCase(nform) || "FULLY-NORMALIZED".equalsIgnoreCase(nform)) {
            normed = Normalizer.normalize(arg, Normalizer.NFKD);
        } else {
            // TODO "FULLY-NORMALIZED"
            throw new DynamicError("err:FOCH0003", "Unsupported normalizationForm: " + nform);
        }
        return XString.valueOf(normed);
    }
View Full Code Here

Examples of xbird.xquery.DynamicError

                        ;
                    }
                }
                is = conn.getInputStream();
            } catch (IOException e) {
                throw new DynamicError("Openning a document failed: " + unescaped, e);
            }
            final boolean resolveEntity = unescaped.startsWith("http");
            final DocumentTableModel dtm = new DocumentTableModel(parseAsHtml, resolveEntity);
            try {
                dtm.loadDocument(is, dynEnv);
            } catch (XQueryException e) {
                throw new DynamicError("loading a document failed: " + unescaped, e);
            }
            xqdoc = dtm.documentNode();
            xqdoc.setDocumentUri(unescaped);
            _sharedCache.put(docurl, xqdoc);
        }
View Full Code Here

Examples of xbird.xquery.DynamicError

        return focus.getContextItem();
    }

    public int contextPosition() throws DynamicError {
        if(focus == null) {
            throw new DynamicError("err:XPDY0002", "ContentPosition is not set");
        }
        return focus.getContextPosition();
    }
View Full Code Here

Examples of xbird.xquery.DynamicError

        public static BigDecimal compute(final Item v1, final Item v2, final DynamicContext dynEnv)
                throws XQueryException {
            final BigDecimal divisor = asDecimal(v2, dynEnv);
            if(divisor.equals(BigDecimal.ZERO)) {
                throw new DynamicError("err:FOAR0001", "divide by zero");
            }
            BigDecimal dv1 = asDecimal(v1, dynEnv);
            BigDecimal res = XDecimal.divide(dv1, divisor);
            return res;
        }
View Full Code Here

Examples of xbird.xquery.DynamicError

            } else {
                dur1 = (DurationValue) v2;
                divisor = NumericOp.asDouble(v1, dynEnv);
            }
            if(divisor == 0) {
                throw new DynamicError("err:FODT0002", "Overflow in duration arithmetic, divided by zero");
            }
            if(Double.isNaN(divisor)) {
                throw new DynamicError("err:FOCA0005", "$arg2 is NaN");
            }
            double res = 1.0 / divisor;
            DurationValue resDur = dur1.multiply(res);
            return resDur;
        }
View Full Code Here

Examples of xbird.xquery.DynamicError

                //TODO else if(dt1 == TypeTable.DAYTIME_DURATION_TID) {}
            }

            final double divisor = d2.getTimeInMillis();
            if(divisor == 0) {
                throw new DynamicError("err:FODT0002", "Overflow in duration arithmetic, divided by zero");
            }
            if(Double.isNaN(divisor)) {
                throw new DynamicError("err:FOCA0005", "$arg2 is NaN");
            }
            double l1 = d1.getTimeInMillis();
            double res = l1 / divisor;
            BigDecimal bdv = BigDecimal.valueOf(res);
            return XDecimal.valueOf(bdv);
View Full Code Here

Examples of xbird.xquery.DynamicError

        private static XDecimal evalYearMonthDuration(final DurationValue d1, final DurationValue d2)
                throws DynamicError {
            final int divisor = d2.totalMonths();
            if(divisor == 0) {
                throw new DynamicError("err:FODT0002", "Overflow in duration arithmetic, divided by zero");
            }
            double m1 = d1.totalMonths();
            double res = m1 / divisor;
            BigDecimal bdv = BigDecimal.valueOf(res);
            return XDecimal.valueOf(bdv);
View Full Code Here

Examples of xbird.xquery.DynamicError

            case TypeTable.NUMERIC_TID:
                v = this;
                break;
            case TypeTable.INTEGER_TID:
                if(Float.isNaN(value)) {
                    throw new DynamicError("err:FOCA0002", "Can't convert xs:double(" + toString()
                            + ") to xs:integer");
                }
                if(Float.isInfinite(value)) {
                    throw new DynamicError("err:FOCA0002", "Can't convert xs:double(" + toString()
                            + ") to xs:integer");
                }
                v = XInteger.valueOf(asLong());
                break;
            case TypeTable.DOUBLE_TID:
View Full Code Here

Examples of xbird.xquery.DynamicError

        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

Examples of xbird.xquery.DynamicError

        if(literal == null) {
            throw new IllegalArgumentException();
        }
        final int strlen = literal.length();
        if(strlen < 4 || !literal.startsWith("--")) {
            throw new DynamicError("err:FORG0001", "Illegal value for xs:gMonth: " + literal);
        }
        StringBuilder buf = new StringBuilder(strlen + 2);
        buf.append(literal.substring(0, 4));
        // [workaround] gMonth, --MM(z?), but per XML Schema Errata, used to be --MM--(z?)
        buf.append("--");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.