Package com.google.caja.reporting

Examples of com.google.caja.reporting.Message


      if (!allowedInLinkClass && propName.getCanonicalForm().startsWith("_")) {
        allowedInLinkClass = propertyNames.contains(Name.css(
            propName.getCanonicalForm().substring(1)));
      }
      if (!allowedInLinkClass || mightContainUrl(pd.getExpr())) {
        mq.getMessages().add(new Message(
            PluginMessageType.DISALLOWED_CSS_PROPERTY_IN_SELECTOR,
            this.invalidNodeMessageLevel,
            p.getFilePosition(), p.getPropertyName(),
            sel.node.getFilePosition()));
        mut.removeChild(child);
View Full Code Here


          origName, newName, declSite);
      vars.put(origName, vi);
      return vi;
    } else {
      FilePosition dPos = d.declaredAt;
      throw new RedeclarationException(new Message(
          RewriterMessageType.CANNOT_REDECLARE_VAR, declSite,
          MessagePart.Factory.valueOf(origName.toString()), dPos));
    }
  }
View Full Code Here

        if (tq.isEmpty()) { break; }
        addIfNotNull(stmts, parseStatement());
      }
      return new CssTree.StyleSheet(pos(m), stmts);
    } catch (RuntimeException e) {
      throw new ParseException(new Message(MessageType.PARSE_ERROR,
          tq.currentPosition()), e);
    }
  }
View Full Code Here

        addIfNotNull(decls, parseDeclaration());
        if (!tq.checkToken(";")) { break; }
      }
      return new CssTree.DeclarationGroup(pos(m), decls);
    } catch (RuntimeException e) {
      throw new ParseException(new Message(MessageType.PARSE_ERROR,
          tq.currentPosition()), e);
    }
  }
View Full Code Here

    if (CssTokenType.STRING == t.type) {
      String s = unescape(t);
      charset = s.substring(1, s.length() - 1);
      // TODO(pulkitgoyal2000): Handle non utf-8 charset
      if (!Strings.eqIgnoreCase("utf-8", charset)) {
        Message msg = new Message(MessageType.EXPECTED_TOKEN,
            MessageLevel.WARNING, t.pos, MessagePart.Factory.valueOf("utf-8"),
            MessagePart.Factory.valueOf(charset));
        mq.addMessage(msg);
        SKIP_TO_CHUNK_END_FROM_OUTSIDE_BLOCK.recover(this, m);
        return null;
View Full Code Here

        && Strings.eqIgnoreCase(
        symbol, (unescape ? unescape(t) : t.text))) {
      return;
    }
    throw new ParseException(
        new Message(
            MessageType.EXPECTED_TOKEN, t.pos,
            MessagePart.Factory.valueOf(symbol),
            MessagePart.Factory.valueOf(t.text)));
  }
View Full Code Here

   * @param <T> this always returns null, and the type parameter allows us
   *     to return the right kind of null.
   */
  private <T> T throwOrReport(MessageTypeInt t, MessagePart... parts)
      throws ParseException {
    Message msg = new Message(t, tolerance, parts);
    if (isTolerant) {
      mq.getMessages().add(msg);
      return null;
    } else {
      throw new ParseException(msg);
View Full Code Here

    if (oldDefinition != null) {
      LocalType oldType = oldDefinition.a;
      if (oldType != type
          || oldType.implies(LocalType.FUNCTION)
          || type.implies(LocalType.FUNCTION)) {
        s.rewriter.mq.getMessages().add(new Message(
            MessageType.SYMBOL_REDEFINED,
            MessageLevel.LINT,
            ident.getFilePosition(),
            MessagePart.Factory.valueOf(name),
            oldDefinition.b));
      }
    }
    for (Scope ancestor = s.parent; ancestor != null;
         ancestor = ancestor.parent) {
      Pair<LocalType, FilePosition> maskedDefinition
          = ancestor.locals.get(name);
      if (maskedDefinition == null) { continue; }

      LocalType maskedType = maskedDefinition.a;
      // Do not generate a LINT error in the case where a function masks
      // itself.  We recognize a self-mask when we come across a "new"
      // function in the same scope as a declared function or constructor.
      if (maskedType != type
          && !(maskedType == LocalType.DECLARED_FUNCTION
               && type == LocalType.FUNCTION)) {
        // This used to treat masking catch variables as errors, because
        // of IE<=8 behavior, but masking is unfortunately common, and
        // the IE<=8 bug doesn't appears to be a security issue.
        // http://code.google.com/p/google-caja/issues/detail?id=1456
        if (!ident.isSynthetic() &&
            ident.getFilePosition() != null) {
          s.rewriter.mq.getMessages().add(new Message(
              MessageType.MASKING_SYMBOL,
              MessageLevel.LINT,
              ident.getFilePosition(),
              MessagePart.Factory.valueOf(name),
              maskedDefinition.b));
View Full Code Here

        push(newElement, ns, elQName);
      }
    } else {
      String bottomElementName = getBottom().qname;
      if (!elQName.equals(bottomElementName)) {
        throw new IllegalDocumentStateException(new Message(
            DomParserMessageType.UNMATCHED_END,
            start.pos, MessagePart.Factory.valueOf(start.text),
            MessagePart.Factory.valueOf("<" + bottomElementName)));
      }
      popN(1, end.pos);
View Full Code Here

    }

    int nOpen = getNOpenElements();
    if (nOpen != 1) {
      Element openEl = getElement(nOpen - 1);
      throw new IllegalDocumentStateException(new Message(
          DomParserMessageType.MISSING_END, endOfDocument,
          MessagePart.Factory.valueOf(openEl.getTagName()),
          Nodes.getFilePositionFor(openEl)));
    }
  }
View Full Code Here

TOP

Related Classes of com.google.caja.reporting.Message

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.