Examples of JSilverAutoEscapingException


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

    if (autoEscapeContext != null) {
      if (!startingAutoEscapeState.equals(autoEscapeContext.getCurrentState())) {
        // We do not allow a macro call to change context of the rest of the template.
        // Since the rest of the template has already been auto-escaped at parse time
        // with the assumption that the macro call will not modify the context.
        throw new JSilverAutoEscapingException("Macro starts in context " + startingAutoEscapeState
            + " but ends in different context " + autoEscapeContext.getCurrentState(),
            autoEscapeContext.getResourceName());
      }
    }
    autoEscapeContext = null;
View Full Code Here

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

        // <input onclick="doClick(START HERE
        return HtmlParserFactory.createParserInAttribute(HtmlParser.ATTR_TYPE.JS, true, null);

      case ESCAPE_AUTO_UNQUOTED_ATTR_JS:
        // <input onclick=doClick('START HERE
        throw new JSilverAutoEscapingException(
            "Attempting to start HTML parser in unsupported mode" + mode, resourceName);

      case ESCAPE_AUTO_UNQUOTED_ATTR_UNQUOTED_JS:
        // <input onclick=doClick(START HERE
        return HtmlParserFactory.createParserInAttribute(HtmlParser.ATTR_TYPE.JS, false, null);

      case ESCAPE_AUTO_ATTR_CSS:
        // <input style="START HERE
        return HtmlParserFactory.createParserInAttribute(HtmlParser.ATTR_TYPE.STYLE, true, null);

      case ESCAPE_AUTO_UNQUOTED_ATTR_CSS:
        // <input style=START HERE
        return HtmlParserFactory.createParserInAttribute(HtmlParser.ATTR_TYPE.STYLE, false, null);

      default:
        throw new JSilverAutoEscapingException("Attempting to start HTML parser in invalid mode"
            + mode, resourceName);
    }
  }
View Full Code Here

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

    try {
      htmlParser.parse(data);
    } catch (ParseException e) {
      // ParseException displays the proper position, so do not store line and column
      // number here.
      throw new JSilverAutoEscapingException("Error in HtmlParser: " + e, resourceName);
    }
  }
View Full Code Here

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

   */
  public void insertText() {
    try {
      htmlParser.insertText();
    } catch (ParseException e) {
      throw new JSilverAutoEscapingException("Error during insertText(): " + e, resourceName,
          htmlParser.getLineNumber(), htmlParser.getColumnNumber());
    }
  }
View Full Code Here

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

      // Default is assumed to be HTML body
      // <b>Hello <?cs var: UserName ?></b> :
      return AutoEscapeState.HTML;
    }

    throw new JSilverAutoEscapingException("Invalid state received from HtmlParser: "
        + state.toString(), resourceName, htmlParser.getLineNumber(), htmlParser.getColumnNumber());
  }
View Full Code Here

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

        } else {
          return AutoEscapeState.UNQUOTED_ATTR_CSS;
        }

      default:
        throw new JSilverAutoEscapingException("Invalid attribute type in HtmlParser: " + type,
            resourceName, htmlParser.getLineNumber(), htmlParser.getColumnNumber());
    }
  }
View Full Code Here

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

   * @see #CONTENT_TYPE_LIST
   */
  public void setContentType(String contentType) {
    HtmlParser.Mode mode = CONTENT_TYPE_LIST.get(contentType);
    if (mode == null) {
      throw new JSilverAutoEscapingException("Invalid content type specified: " + contentType,
          resourceName, htmlParser.getLineNumber(), htmlParser.getColumnNumber());

    }
    htmlParser.resetMode(mode);
  }
View Full Code Here

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

   * @param templateName
   */
  public AutoEscaper(EscapeMode mode, String templateName) {
    this.templateName = templateName;
    if (mode.equals(EscapeMode.ESCAPE_NONE)) {
      throw new JSilverAutoEscapingException("AutoEscaper called when no escaping is required",
          templateName);
    }
    escapeMode = mode;
    if (mode.isAutoEscapingMode()) {
      autoEscapeContext = new AutoEscapeContext(mode, templateName);
View Full Code Here

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

          return;
        }
        // We do not permit templates to end in a different context than they start in.
        // This is so that an included template does not modify the context of
        // the template that includes it.
        throw new JSilverAutoEscapingException("Template starts in context " + startState
            + " but ends in different context " + endState, templateName);
      }
    }
  }
View Full Code Here

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

      node.getOtherwise().apply(this);
    }
    AutoEscapeContext.AutoEscapeState elseEndState = autoEscapeContext.getCurrentState();

    if (!ifEndState.equals(elseEndState)) {
      throw new JSilverAutoEscapingException("'if/else' branches have different ending contexts "
          + ifEndState + " and " + elseEndState, templateName, line, column);
    }
  }
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.