Package webit.script.exceptions

Examples of webit.script.exceptions.ScriptRuntimeException


                : list.toArray(new LoopInfo[list.size()]);
    }

    public static ScriptRuntimeException castToScriptRuntimeException(final Exception exception, final Statement statement) {
        if (exception instanceof ScriptRuntimeException) {
            ScriptRuntimeException scriptException = (ScriptRuntimeException) exception;
            scriptException.registStatement(statement);
            return scriptException;
        } else {
            return new ScriptRuntimeException(exception.toString(), exception, statement);
        }
    }
View Full Code Here


    }

    private TemplateException completeException(final Exception exception) {
        return ((exception instanceof TemplateException)
                ? ((TemplateException) exception)
                : new ScriptRuntimeException(exception)).setTemplate(this);
    }
View Full Code Here

    protected final Object handleNullPointer() {
        if (this.ignoreNullPointer) {
            return null;
        }
        throw new ScriptRuntimeException("Null pointer.");
    }
View Full Code Here

    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

    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

    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

    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

        } 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

            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

            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

TOP

Related Classes of webit.script.exceptions.ScriptRuntimeException

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.