Package com.google.caja.reporting

Examples of com.google.caja.reporting.Message


        + "    </ihtml:attribute>\n"
        + "    Link Text\n"
        + "    <ihtml:attribute>onclick=\"badness()\"</ihtml:attribute>\n"
        + "  </a>\n"
        + "</ihtml:template>",
        new Message(
            IhtmlMessageType.MISSING_ATTRIB,
            FilePosition.instance(is, 8, 264, 5, 54),
            elKey("ihtml:attribute"), attrKey("ihtml:attribute", "name")));
  }
View Full Code Here


        + "    <ihtml:element/>\n"  // OK inside a conditional
        + "  <ihtml:else/>\n"
        + "    <ihtml:element/>\n"  // OK inside a conditional's alternate
        + "  </ihtml:do>\n"
        + "</ihtml:template>",
        new Message(
            IhtmlMessageType.MISPLACED_ELEMENT,
            FilePosition.instance(is, 4, 88, 5, 16),
            MessagePart.Factory.valueOf("ihtml:element"),
            MessagePart.Factory.valueOf("ihtml:message")),
        new Message(
            IhtmlMessageType.MISPLACED_ELEMENT,
            FilePosition.instance(is, 6, 137, 7, 16),
            MessagePart.Factory.valueOf("ihtml:element"),
            MessagePart.Factory.valueOf("ihtml:message")));
  }
View Full Code Here

        + "<ihtml:template formals=\"\" name=\"main\">\n"
        + "  <ihtml:template formals=\"\" name=\"sub\"\n"
        + "   " + IHTML.CALLING_CONTEXT_ATTR + "=\"div\">\n"
        + "  </ihtml:template>\n"
        + "</ihtml:template>",
        new Message(
            IhtmlMessageType.BAD_ATTRIB,
            FilePosition.instance(is, 3, 4, 4, 20),
            elKey("ihtml:template"),
            attrKey("ihtml:template", "callingContext"),
            MessagePart.Factory.valueOf("div")));
View Full Code Here

                                 MessageType type,
                                 String filePositionString,
                                 Object... otherMessageParts)
      throws Exception {
    assertTrue(msgs.hasNext());
    Message m = msgs.next();
    assertEquals(type, m.getMessageType());
    assertFilePosition(
        filePositionString,
        (FilePosition) m.getMessageParts().get(0), mc);
    for (int i = 0; i < otherMessageParts.length; i++) {
      assertEquals(otherMessageParts[i], m.getMessageParts().get(i + 1));
    }
  }
View Full Code Here

    FilePosition b2 = FilePosition.instance(b, 2, 20, 10);
    FilePosition c1 = FilePosition.instance(c, 1, 10, 10);
    FilePosition c2 = FilePosition.instance(c, 2, 20, 10);
    FilePosition c12 = FilePosition.span(c1, c2);

    Message ma12 = new Message(TestMessageType.MT, a12);
    Message mc2 = new Message(TestMessageType.MT, c2);
    Message mc12 = new Message(TestMessageType.MT, c12);
    Message mb2 = new Message(TestMessageType.MT, b2);
    Message ma = new Message(TestMessageType.MT, a);
    Message mb = new Message(TestMessageType.MT, b);
    Message mc1 = new Message(TestMessageType.MT, c1);
    Message ma1 = new Message(TestMessageType.MT, a1);
    Message ma2 = new Message(TestMessageType.MT, a2);
    Message mhi = new Message(
        TestMessageType.MT, MessagePart.Factory.valueOf("hi"));
    Message mhithere = new Message(
        TestMessageType.MT, MessagePart.Factory.valueOf("hi there"));

    List<Message> messages = Arrays.asList(
        ma12, mhithere, mc2, mc12, mb2, ma, mb, mc1, ma1, ma2, mhi);
View Full Code Here

      pex = ex;
    }
    if (pex == null) {
      fail("Mismatched quote did not result in exception");
    } else {
      Message msg = pex.getCajaMessage();
      assertEquals(DomParserMessageType.UNCLOSED_TAG, msg.getMessageType());
      assertEquals(
          "testEofMessageDueToMismatchedQuotes:1+6@6 - 10@10",
          msg.getMessageParts().get(0).toString());
    }
  }
View Full Code Here

    URI uri;
    try {
      uri = new URI(attr.getNodeValue());
    } catch (URISyntaxException ex) {
      mq.getMessages().add(
          new Message(PluginMessageType.MALFORMED_URL, MessageLevel.ERROR,
                      Nodes.getFilePositionFor(attr), a));
      return null;
    }
    return new ExternalReference(uri, Nodes.getFilePositionForValue(attr));
  }
View Full Code Here

    public final String expectedMimeType;

    public UriFetchException(
        ExternalReference ref, String mimeType, Throwable cause) {
      super(
          new Message(
              PluginMessageType.FAILED_TO_LOAD_EXTERNAL_URL,
              ref.getReferencePosition(),
              MessagePart.Factory.valueOf(ref.getUri().toString())),
          cause);
      this.ref = ref;
View Full Code Here

   */
  <T> T expect(Object obj, Class<T> clazz, String part)
      throws ParseException {
    if (clazz.isInstance(obj)) { return clazz.cast(obj); }
    throw new ParseException(
        new Message(ConfigMessageType.MALFORMED_CONFIG, src,
                    MessagePart.Factory.valueOf(part),
                    MessagePart.Factory.valueOf(String.valueOf(obj))));
  }
View Full Code Here

            }
          } else if (node instanceof CssTree.Term
                     && (CssPropertyPartType.URI == propertyPartType(node))) {

            boolean remove = false;
            Message removeMsg = null;

            CssTree term = (CssTree.Term) node;
            CssTree.CssLiteral content =
                (CssTree.CssLiteral) term.children().get(0);

            if (content instanceof CssTree.Substitution) {
              return true// Handled by later pass.
            }

            String uriStr = content.getValue();
            try {
              URI baseUri = content.getFilePosition().source().getUri();
              URI relUri = new URI(uriStr);
              URI uri = baseUri.resolve(relUri);
              ExternalReference ref = new ExternalReference(
                  uri, baseUri, relUri, content.getFilePosition());
              Name propertyPart = propertyPart(node)// TODO
              if (uriPolicy != null) {
                String rewritten = UriPolicyNanny.apply(
                    uriPolicy,
                    ref, UriEffect.SAME_DOCUMENT, LoaderType.SANDBOXED,
                    Collections.singletonMap(
                        UriPolicyHintKey.CSS_PROP.key, propertyPart));
                if (rewritten == null) {
                  removeMsg = new Message(
                      PluginMessageType.DISALLOWED_URI,
                      node.getFilePosition(),
                      MessagePart.Factory.valueOf(uriStr));
                  remove = true;
                }
              }
            } catch (URISyntaxException ex) {
              removeMsg = new Message(
                  PluginMessageType.DISALLOWED_URI,
                  node.getFilePosition(), MessagePart.Factory.valueOf(uriStr));
              remove = true;
            }
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.