Package freemarker.core

Examples of freemarker.core.InvalidReferenceException


            return new ConstructorFunction(classString, env);
        } catch (ClassCastException cce) {
            throw new TemplateModelException("Expecting string on left of ?new built-in");

        } catch (NullPointerException npe) {
            throw new InvalidReferenceException("undefined string on left of ?new built-in", env);
        }
    }
View Full Code Here


        try {
            return new SimpleNumber(getNumber(((TemplateNumberModel) model).getAsNumber(), caller.getName()));
        } catch (ClassCastException cce) {
            throw TemplateNode.invalidTypeException(model, caller.getTarget(), env, "number");
        } catch (NullPointerException npe) {
            throw new InvalidReferenceException("Undefined number", env);
        }
    }
View Full Code Here

        }
        else {
            string = Expression.getStringValue(model, caller.getTarget(), env);
        }
        if (string == null) {
            throw new InvalidReferenceException("String is undefined", env);
        }
        return new SimpleScalar(apply(string));
    }
View Full Code Here

            String string = ((TemplateScalarModel) model).getAsString();
            return apply(string, env, caller);
        } catch (ClassCastException cce) {
            throw TemplateNode.invalidTypeException(model, caller.getTarget(), env, "string");
        } catch (NullPointerException npe) {
            throw new InvalidReferenceException("String is undefined", env);
        }
    }
View Full Code Here

    public void execute(Environment env) throws TemplateException, IOException {
        String templateNameString = templateName.getStringValue(env);
        if( templateNameString == null ) {
            String msg = "Error " + getStartLocation()
                        + "The expression " + templateName + " is undefined.";
            throw new InvalidReferenceException(msg, env);
        }
        Template importedTemplate;
        try {
            if (templateNameString.indexOf("://") >0) {
                ;
View Full Code Here

        else if (model instanceof TemplateScalarModel) {
            interpretString = ((TemplateScalarModel) model).getAsString();
        }
        if (id == null) id = "anonymous_interpreted";
        if (interpretString == null) {
            throw new InvalidReferenceException("No string to interpret", env);
        }
        Template parentTemplate = env.getTemplate();
        try {
            Template template = new Template(parentTemplate.getName() + "$" + id, new StringReader(interpretString), parentTemplate.getConfiguration());
            template.setLocale(env.getLocale());
View Full Code Here

    {
        if(model instanceof TemplateNumberModel) {
            return getNumber((TemplateNumberModel)model, expr, env);
        }
        else if(model == null) {
            throw new InvalidReferenceException(expr + " is undefined.", env);
        }
        else if(model == TemplateModel.JAVA_NULL) {
            throw new InvalidReferenceException(expr + " is null.", env);
        }
        else {
            throw new NonNumericalException(expr + " is not a number, it is " + model.getClass().getName(), env);
        }
    }
View Full Code Here

      Scope scope = null;
      if (namespaceExp != null) {
        try {
          scope = (Scope) namespaceExp.getAsTemplateModel(env);
        } catch (ClassCastException cce) {
                throw new InvalidReferenceException(getStartLocation() + "\nInvalid reference to namespace: " + namespaceExp, env);
        }
      }
      else {
        if (type == AssignmentInstruction.NAMESPACE) {
          scope = env.getCurrentNamespace();
View Full Code Here

  private Locale locale;
 
    public void assertNonNull(TemplateModel model, Expression exp, Environment env) throws InvalidReferenceException {
        assertIsDefined(model, exp, env);
        if (model == TemplateModel.JAVA_NULL) {
            throw new InvalidReferenceException(
                "Expression " + exp + " is null " +
                exp.getStartLocation() + ".", env);
        }
    }
View Full Code Here

        }
    }
   
    public void assertIsDefined(TemplateModel model, Expression exp, Environment env) throws InvalidReferenceException {
        if (model == null) {
            throw new InvalidReferenceException(
                "Expression " + exp + " is undefined " +
                exp.getStartLocation() + ".", env);
        }
    }
View Full Code Here

TOP

Related Classes of freemarker.core.InvalidReferenceException

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.