Package com.google.clearsilver.jsilver.exceptions

Examples of com.google.clearsilver.jsilver.exceptions.JSilverInterpreterException


  @Override
  public Macro findMacro(String name) {
    Macro macro = macros.get(name);
    if (macro == null) {
      throw new JSilverInterpreterException("No such macro: " + name);
    }
    return macro;
  }
View Full Code Here


  }

  @Override
  public void pushAutoEscapeMode(EscapeMode mode) {
    if (isRuntimeAutoEscaping()) {
      throw new JSilverInterpreterException(
          "cannot call pushAutoEscapeMode while runtime auto escaping is in progress");
    }
    autoEscapeStack.add(autoEscapeMode);
    autoEscapeMode = mode;
  }
View Full Code Here

   *         autoescaping is already in progress.
   */
  @Override
  public void startRuntimeAutoEscaping() {
    if (isRuntimeAutoEscaping()) {
      throw new JSilverInterpreterException("startRuntimeAutoEscaping() is not re-entrant at "
          + getCurrentResourceName());
    }
    if (!autoEscapeMode.equals(EscapeMode.ESCAPE_NONE)) {
      // TODO: Get the resourceName as a parameter to this function
      autoEscapeContext = new AutoEscapeContext(autoEscapeMode, getCurrentResourceName());
View Full Code Here

   *        loader should be ignored, {@code false} otherwise.
   * @param context Rendering context to use for the included template.
   */
  protected void include(String templateName, boolean ignoreMissingFile, RenderingContext context) {
    if (!context.pushIncludeStackEntry(templateName)) {
      throw new JSilverInterpreterException(createIncludeLoopErrorMessage(templateName, context
          .getIncludedTemplateNames()));
    }

    loadAndRenderIncludedTemplate(templateName, ignoreMissingFile, context);

View Full Code Here

    }
    // Intepret loaded template.
    try {
      template.render(context);
    } catch (IOException e) {
      throw new JSilverInterpreterException(e.getMessage());
    }
  }
View Full Code Here

    @Override
    public String getArgumentName(int index) {
      if (index >= argumentsNames.length) {
        // TODO: Make sure this behavior of failing if too many
        // arguments are passed to a macro is consistent with JNI / interpreter.
        throw new JSilverInterpreterException("Too many arguments supplied to macro " + macroName);
      }
      return argumentsNames[index];
    }
View Full Code Here

  @Override
  public Value executeFunction(String name, Value... args) {
    Function function = functions.get(name);
    if (function == null) {
      throw new JSilverInterpreterException("Function not found " + name);
    }
    Value result = function.execute(args);
    if (result == null) {
      throw new JSilverInterpreterException("Function " + name + " did not return value");
    }
    return result;
  }
View Full Code Here

    if (name == null || name.isEmpty() || name.equals("none")) {
      output.append(input);
    } else {
      TextFilter escaper = escapers.get(name);
      if (escaper == null) {
        throw new JSilverInterpreterException("Unknown escaper: " + name);
      }
      escaper.filter(input, output);
    }
  }
View Full Code Here

  @Override
  public boolean isEscapingFunction(String name) {
    Function function = functions.get(name);
    if (function == null) {
      throw new JSilverInterpreterException("Function not found " + name);
    }
    return function.isEscapingFunction();
  }
View Full Code Here

        String in = args[0].asString();
        StringBuilder out = new StringBuilder(in.length());
        try {
          textFilter.filter(in, out);
        } catch (IOException e) {
          throw new JSilverInterpreterException(e.getMessage());
        }

        EscapeMode mode;
        boolean isPartiallyEscaped;
        if (isEscaper) {
View Full Code Here

TOP

Related Classes of com.google.clearsilver.jsilver.exceptions.JSilverInterpreterException

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.