Package com.google.caja.reporting

Examples of com.google.caja.reporting.MessageContext


    CssTree.StyleSheet stylesheet = new CssParser(
        CssParser.makeTokenQueue(css.clone(), mq, false), mq, lvl)
        .parseStyleSheet();
    assertCloneable(stylesheet);
    StringBuilder sb = new StringBuilder();
    stylesheet.format(new MessageContext(), sb);
    assertEquals(golden.toString().trim(), sb.toString().trim());

    if (!tolerant) {
      // run in tolerant mode to make sure being tolerant doesn't introduce
      // failures.
View Full Code Here


    return (Statement) StatementSimplifier.optimize(block, mq);
  }

  public static void main(String... args) throws IOException {
    MessageQueue mq = new SimpleMessageQueue();
    MessageContext mc = new MessageContext();
    JsOptimizer opt = new JsOptimizer(mq);
    opt.setRename(true);
    opt.setEnvJson(new ObjectConstructor(FilePosition.UNKNOWN));
    try {
      for (int i = 0, n = args.length; i < n; ++i) {
        String arg = args[i];
        if ("--norename".equals(arg)) {
          opt.setRename(false);
        } else if (arg.startsWith("--envjson=")) {
          String jsonfile = arg.substring(arg.indexOf('=') + 1);
          opt.setEnvJson((ObjectConstructor) jsExpr(fromFile(jsonfile), mq));
        } else {
          if ("--".equals(arg)) { ++i; }
          for (;i < n; ++i) {
            CharProducer cp = fromFile(args[i]);
            mc.addInputSource(cp.getCurrentPosition().source());
            opt.addInput(js(cp, mq));
          }
        }
      }
    } catch (ParseException ex) {
View Full Code Here

      };
    } else {
      policy = prePolicy;
    }

    MessageContext mc = new MessageContext();

    String language = (String) options.get("language");
    String rendererType = (String) options.get("renderer");

    if ("javascript".equals(language) && "concat".equals(rendererType)) {
View Full Code Here

    this.ignores = ignores;
  }

  public boolean build(List<File> inputs, List<File> dependencies,
      Map<String, Object> options, File output) throws IOException {
    MessageContext mc = new MessageContext();
    Map<InputSource, CharSequence> contentMap = Maps.newLinkedHashMap();
    MessageQueue mq = new SimpleMessageQueue();
    List<LintJob> lintJobs = parseInputs(inputs, contentMap, mc, mq);
    lint(lintJobs, env, mq);
    if (!ignores.isEmpty()) {
View Full Code Here

  public static boolean transfInnocent(Pair<InputSource, File> input,
      Writer out, PrintWriter err)
      throws IOException {

    MessageContext mc = new MessageContext();
    mc.addInputSource(input.a);

    final MessageQueue errs = new EchoingMessageQueue(
        err, mc, false);
    CharProducer cp = CharProducer.Factory.create(
        new InputStreamReader(new FileInputStream(input.b),
View Full Code Here

        if (delta != 0) { return delta; }
        delta = Long.signum(aEPos - bEPos);
        if (delta != 0) { return delta; }

        StringBuilder aBuf = new StringBuilder(), bBuf = new StringBuilder();
        MessageContext mc = new MessageContext();
        try {
          a0.format(mc, aBuf);
          b0.format(mc, bBuf);
        } catch (IOException ex) {
          throw new RuntimeException(ex);
View Full Code Here

      FilePosition elements = FilePosition.startOfFile(new InputSource(
          elementsFile.getAbsoluteFile().toURI()));
      FilePosition attrs = FilePosition.startOfFile(new InputSource(
          attrsFile.getAbsoluteFile().toURI()));

      MessageContext mc = new MessageContext();
      mc.addInputSource(elements.source());
      mc.addInputSource(attrs.source());
      MessageQueue mq = new EchoingMessageQueue(
          new PrintWriter(new OutputStreamWriter(System.err), true), mc, false);

      Set<File> inputsAndDeps = new HashSet<File>();
      for (File f : inputs) { inputsAndDeps.add(f.getAbsoluteFile()); }
View Full Code Here

  public SomethingWidgyHappenedError(String msg) { super(msg); }
  public SomethingWidgyHappenedError(Throwable t) { super(t); }
  public SomethingWidgyHappenedError(String m, Throwable t) { super(m, t); }

  public SomethingWidgyHappenedError(Message msg, Throwable cause) {
    super(msg.format(new MessageContext()), cause);
  }
View Full Code Here

  private Message msg;

  public CajaException(Message msg) { this(msg, null); }

  public CajaException(Message msg, Throwable cause) {
    super(msg.format(new MessageContext()), cause);
    this.msg = msg;
  }
View Full Code Here

  }

  public static boolean minify(Iterable<Pair<InputSource, File>> inputs,
                               Writer out, PrintWriter err)
      throws IOException {
    MessageContext mc = new MessageContext();
    for (Pair<InputSource, File> input : inputs) {
      mc.addInputSource(input.a);
    }
    final MessageQueue errs = new EchoingMessageQueue(
        err, mc, false);
    RenderContext rc = new RenderContext(
        new JsMinimalPrinter(new Concatenator(out, new Callback<IOException>() {
View Full Code Here

TOP

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

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.