Examples of ErrorCollector


Examples of com.google.reducisaurus.servlets.ErrorCollector

  }

  private String compressNoErrors(String js) throws Exception {
    StringReader input = new StringReader(js);
    StringWriter output = new StringWriter();
    ErrorCollector errorCollector = new ErrorCollector();
    new JsCompressor().compress(input, output, errorCollector);
    return output.toString();
  }
View Full Code Here

Examples of com.isencia.passerelle.ext.ErrorCollector

  }

  public void reportError(PasserelleException e) {
      if (!errorCollectors.isEmpty()) {
        for (Iterator<ErrorCollector> errCollItr = errorCollectors.iterator(); errCollItr.hasNext();) {
          ErrorCollector element = errCollItr.next();
          element.acceptError(e);
        }
      } else {
        LOGGER.error("reportError() - no errorCollectors but received exception", e);
      }
    }
View Full Code Here

Examples of com.redhat.ceylon.compiler.java.test.ErrorCollector

    }

    @Test
    public void testBug1347() {
        Assume.assumeTrue("Runs on JDK8", JDKUtils.jdk == JDKUtils.JDK.JDK8);
        ErrorCollector c = new ErrorCollector();
        assertCompilesOk(c, getCompilerTask(Arrays.asList("-rep", "test/java8/modules"), c, "bug13xx/bug1347/bug1347.ceylon").call2());
    }
View Full Code Here

Examples of com.webobjects.monitor.application.WOTaskdHandler.ErrorCollector

   
    public WOResponse statisticsAction() {
        ERXResponse response = new ERXResponse();
        String pw = context().request().stringFormValueForKey("pw");
        if(siteConfig().compareStringWithPassword(pw)) {
            WOTaskdHandler handler = new WOTaskdHandler(new ErrorCollector() {

                public void addObjectsFromArrayIfAbsentToErrorMessageArray(NSArray<String> aErrors) {
                   
                }});
            handler.startReading();
View Full Code Here

Examples of net.sourceforge.htmlunit.corejs.javascript.ast.ErrorCollector

      env.setStrictMode(true);
      env.setWarnTrailingComma(true);
      env.setLanguageVersion(170);
      env.setReservedKeywordAsIdentifier(true);
      env.setIdeMode(true);
      env.setErrorReporter(new ErrorCollector());
      return env;
    }
View Full Code Here

Examples of org.apache.drill.common.expression.ErrorCollector

    return ret.e;
  }

  private String getExpressionCode(String expression, RecordBatch batch) throws Exception {
    LogicalExpression expr = parseExpr(expression);
    ErrorCollector error = new ErrorCollectorImpl();
    LogicalExpression materializedExpr = ExpressionTreeMaterializer.materialize(expr, batch, error);
    if (error.getErrorCount() != 0) {
      logger.error("Failure while materializing expression [{}].  Errors: {}", expression, error);
      assertEquals(0, error.getErrorCount());
    }

    CodeGenerator<Projector> cg = new CodeGenerator<Projector>(Projector.TEMPLATE_DEFINITION, new FunctionImplementationRegistry(DrillConfig.create()));
    cg.addExpr(new ValueVectorWriteExpression(new TypedFieldId(materializedExpr.getMajorType(), -1), materializedExpr));
    return cg.generate();
View Full Code Here

Examples of org.apache.drill.common.expression.ErrorCollector

  }

  @Test
  public void testMaterializingConstantTree(@Injectable RecordBatch batch) throws SchemaChangeException {

    ErrorCollector ec = new ErrorCollectorImpl();
    LogicalExpression expr = ExpressionTreeMaterializer.materialize(new ValueExpressions.LongExpression(1L,
        ExpressionPosition.UNKNOWN), batch, ec);
    assertTrue(expr instanceof ValueExpressions.LongExpression);
    assertEquals(1L, ValueExpressions.LongExpression.class.cast(expr).getLong());
    assertFalse(ec.hasErrors());
  }
View Full Code Here

Examples of org.apache.drill.common.expression.ErrorCollector

        batch.getValueVectorId(new FieldReference("test", ExpressionPosition.UNKNOWN));
        result = new TypedFieldId(Types.required(MinorType.BIGINT), -5);
      }
    };

    ErrorCollector ec = new ErrorCollectorImpl();
    LogicalExpression expr = ExpressionTreeMaterializer.materialize(new FieldReference("test",
        ExpressionPosition.UNKNOWN), batch, ec);
    assertEquals(bigIntType, expr.getMajorType());
    assertFalse(ec.hasErrors());
  }
View Full Code Here

Examples of org.apache.drill.common.expression.ErrorCollector

        batch.getValueVectorId(new FieldReference("test1", ExpressionPosition.UNKNOWN));
        result = new TypedFieldId(Types.required(MinorType.BIGINT), -5);
      }
    };

    ErrorCollector ec = new ErrorCollectorImpl();

    LogicalExpression expr = new IfExpression.Builder()
        .addCondition(
            new IfExpression.IfCondition( //
                new FieldReference("test", ExpressionPosition.UNKNOWN), //
                new IfExpression.Builder()
                    //
                    .addCondition( //
                        new IfExpression.IfCondition(
                            //
                            new ValueExpressions.BooleanExpression("true", ExpressionPosition.UNKNOWN),
                            new FieldReference("test1", ExpressionPosition.UNKNOWN)))
                    .setElse(new ValueExpressions.LongExpression(1L, ExpressionPosition.UNKNOWN)).build()) //
        ) //
        .setElse(new ValueExpressions.LongExpression(1L, ExpressionPosition.UNKNOWN)).build();
    LogicalExpression newExpr = ExpressionTreeMaterializer.materialize(expr, batch, ec);
    assertTrue(newExpr instanceof IfExpression);
    IfExpression newIfExpr = (IfExpression) newExpr;
    assertEquals(1, newIfExpr.conditions.size());
    IfExpression.IfCondition ifCondition = newIfExpr.conditions.get(0);
    assertTrue(ifCondition.expression instanceof IfExpression);
    newIfExpr = (IfExpression) ifCondition.expression;
    assertEquals(1, newIfExpr.conditions.size());
    ifCondition = newIfExpr.conditions.get(0);
    assertEquals(bigIntType, ifCondition.expression.getMajorType());
    assertEquals(true, ((ValueExpressions.BooleanExpression) ifCondition.condition).value);
    if (ec.hasErrors())
      System.out.println(ec.toErrorString());
    assertFalse(ec.hasErrors());
  }
View Full Code Here

Examples of org.apache.drill.common.expression.ErrorCollector

    assertFalse(ec.hasErrors());
  }

  @Test
  public void testMaterializingLateboundTreeValidated(final @Injectable RecordBatch batch) throws SchemaChangeException {
    ErrorCollector ec = new ErrorCollector() {
      int errorCount = 0;

      @Override
      public void addGeneralError(ExpressionPosition expr, String s) {
        errorCount++;
      }

      @Override
      public void addUnexpectedArgumentType(ExpressionPosition expr, String name, MajorType actual,
          MajorType[] expected, int argumentIndex) {
        errorCount++;
      }

      @Override
      public void addUnexpectedArgumentCount(ExpressionPosition expr, int actual, Range<Integer> expected) {
        errorCount++;
      }

      @Override
      public void addUnexpectedArgumentCount(ExpressionPosition expr, int actual, int expected) {
        errorCount++;
      }

      @Override
      public void addNonNumericType(ExpressionPosition expr, MajorType actual) {
        errorCount++;
      }

      @Override
      public void addUnexpectedType(ExpressionPosition expr, int index, MajorType actual) {
        errorCount++;
      }

      @Override
      public void addExpectedConstantValue(ExpressionPosition expr, int actual, String s) {
        errorCount++;
      }

      @Override
      public boolean hasErrors() {
        return errorCount > 0;
      }

      @Override
      public String toErrorString() {
        return String.format("Found %s errors.", errorCount);
      }

      @Override
      public int getErrorCount() {
        return errorCount;
      }
    };

    new NonStrictExpectations() {
      {
        batch.getValueVectorId(new FieldReference("test", ExpressionPosition.UNKNOWN));
        result = new TypedFieldId(Types.required(MinorType.BIGINT), -5);
      }
    };

   
    LogicalExpression functionCallExpr = new FunctionCall(FunctionDefinition.simple("testFunc",
        new ArgumentValidator() {
          @Override
          public void validateArguments(ExpressionPosition expr, List<LogicalExpression> expressions,
              ErrorCollector errors) {
            errors.addGeneralError(expr, "Error!");
          }

          @Override
          public String[] getArgumentNamesByPosition() {
            return new String[0];
          }
        }, OutputTypeDeterminer.FIXED_BIT), ImmutableList.of((LogicalExpression) //
            new FieldReference("test", ExpressionPosition.UNKNOWN) ), ExpressionPosition.UNKNOWN);
    LogicalExpression newExpr = ExpressionTreeMaterializer.materialize(functionCallExpr, batch, ec);
    assertTrue(newExpr instanceof FunctionCall);
    FunctionCall funcExpr = (FunctionCall) newExpr;
    assertEquals(1, funcExpr.args.size());
    assertEquals(bigIntType, funcExpr.args.get(0).getMajorType());
    assertEquals(1, ec.getErrorCount());
    System.out.println(ec.toErrorString());
  }
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.