Examples of ScriptRuntimeException


Examples of webit.script.exceptions.ScriptRuntimeException

    private static boolean notDoubleOrFloat(Object o1, Object o2) {
        return notDoubleOrFloat(o1) && notDoubleOrFloat(o2);
    }

    private static ScriptRuntimeException unsupportedTypeException(final Object o1, final Object o2) {
        return new ScriptRuntimeException(StringUtil.format("Unsupported type: left[{}], right[{}]", o1.getClass(), o2.getClass()));
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

    private static ScriptRuntimeException unsupportedTypeException(final Object o1, final Object o2) {
        return new ScriptRuntimeException(StringUtil.format("Unsupported type: left[{}], right[{}]", o1.getClass(), o2.getClass()));
    }

    private static ScriptRuntimeException unsupportedTypeException(final Object o1) {
        return new ScriptRuntimeException(StringUtil.format("Unsupported type: [{}]", o1.getClass()));
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

    private static ScriptRuntimeException unsupportedTypeException(final Object o1) {
        return new ScriptRuntimeException(StringUtil.format("Unsupported type: [{}]", o1.getClass()));
    }

    private static ScriptRuntimeException valueIsNullException() {
        return new ScriptRuntimeException("value is null");
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

    private static ScriptRuntimeException valueIsNullException() {
        return new ScriptRuntimeException("value is null");
    }

    private static ScriptRuntimeException valueIsNullException(final Object o1, final Object o2) {
        return new ScriptRuntimeException(
                o1 == null
                ? (o2 == null ? "left & right values are null" : "left value is null")
                : (o2 == null ? "right value is null" : "left & right values are not null"));
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

        } else if (o1 instanceof Enumeration) {
            return new EnumerationIter((Enumeration) o1);
        } else if (o1 instanceof CharSequence) {
            return new CharSequenceIter((CharSequence) o1);
        }
        throw new ScriptRuntimeException("Unsupported type: ".concat(o1.getClass().getName()), statement);
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

            return null;
        }
        if (o1 instanceof Map) {
            return new MapKeyIter((Map) o1);
        }
        throw new ScriptRuntimeException("Unsupported type: ".concat(o1.getClass().getName()), statement);
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

            if (paramsExpr != null
                    && (paramsObject = paramsExpr.execute(context)) != null) {
                if (paramsObject instanceof Map) {
                    params = KeyValuesUtil.wrap((Map) paramsObject);
                } else {
                    throw new ScriptRuntimeException("Template param must be a Map.", paramsExpr);
                }
            } else {
                params = KeyValuesUtil.EMPTY_KEY_VALUES;
            }
            final Template preTemplate = context.template;
            final KeyValues preRootParams = context.rootParams;
            final Object[] preVars = context.vars;
            final VariantIndexer[] preIndexers = context.indexers;
            final int preIndexer = context.indexer;
            try {
                Template template = engine.getTemplate(myTemplateName, String.valueOf(templateName));
                context.template = template;
                context.rootParams = engine.isShareRootData() ? KeyValuesUtil.wrap(preRootParams, params) : params;
                template.merge(context, params);
                if (export) {
                    Map<String, Object> result = new HashMap<String, Object>();
                    context.exportTo(result);
                    return result;
                }
                return null;
            } catch (Exception e) {
                throw new ScriptRuntimeException(e, this);
            } finally {
                context.template = preTemplate;
                context.rootParams = preRootParams;
                context.vars = preVars;
                context.indexers = preIndexers;
                context.indexer = preIndexer;
            }
        } else {
            throw new ScriptRuntimeException("Template name should not be null.", templateNameExpr);
        }
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

        int index = indexers[this.indexer].getIndex(key);
        if (index >= 0) {
            return this.vars[index];
        }
        if (force) {
            throw new ScriptRuntimeException("Not found variant named:".concat(key));
        }
        return null;
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

            for (int i = 0; i < len; i++) {
                results[i] = exprs[i].execute(context);
            }
            return ((MethodDeclare) funcObject).invoke(context, results);
        }
        throw new ScriptRuntimeException("not a function", this);
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

        Object result;
        final int num1;
        if ((result = leftExpr.execute(context)) instanceof Number) {
            num1 = ((Number) result).intValue();
        } else {
            throw new ScriptRuntimeException(StringUtil.concatObjectClass("left need a int, but found ", result), this);
        }
        final int num2;
        if ((result = rightExpr.execute(context)) instanceof Number) {
            num2 = ((Number) result).intValue();
        } else {
            throw new ScriptRuntimeException(StringUtil.concatObjectClass("right need a int, but found ", result), this);
        }
        if (num1 < num2) {
            return new IntAscIter(num1, num2);
        } else {
            return new IntDescIter(num1, num2);
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.