Package org.mvel2

Examples of org.mvel2.CompileException


        case 'I':
          return new BigInteger(new String(val, start, offset - 1));
        case 'B':
          return new BigDecimal(new String(val, start, offset - 1));
      }
      throw new CompileException("unrecognized numeric literal", val, start);
    }
    else {
      switch (numericTest(val, start, offset)) {
        case DataTypes.FLOAT:
          return java.lang.Float.parseFloat(new String(val, start, offset));
View Full Code Here


            case 'D':
            case 'I':
            case 'B':
              return true;
            case '.':
              throw new CompileException("invalid number literal: " + new String(val), val, start);
          }
          return false;
        }
        else if (i == start + 1 && c == 'x' && val[start] == '0') {
          for (i++; i < end; i++) {
            if (!isDigit(c = val[i])) {
              if ((c < 'A' || c > 'F') && (c < 'a' || c > 'f')) {
                if (i == offset - 1) {
                  switch (c) {
                    case 'l':
                    case 'L':
                    case 'I':
                    case 'B':
                      return true;
                  }
                }

                return false;
              }
            }
          }
          return offset - 2 > 0;

        }
        else if (i != start && (i + 1) < end && (c == 'E' || c == 'e')) {
          if (val[++i] == '-' || val[i] == '+') i++;
        }
        else {
          if (i != start)
            throw new CompileException("invalid number literal: " + new String(val, start, offset), val, start);
          return false;
        }
      }
    }
View Full Code Here

        }

        return newArray;
      }
      catch (IllegalArgumentException e) {
        throw new CompileException("type mismatch in array", expr, start, e);
      }
      catch (ClassNotFoundException e) {
        throw new RuntimeException("this error should never throw:" + getBaseComponentType(type).getName(), e);
      }
    }
View Full Code Here

      this.varName = createStringTrimmed(expr, start, assignStart - start);
      this.assignmentVar = varName;

      this.start = skipWhitespace(expr, assignStart + 1);
      if (this.start >= start + offset) {
        throw new CompileException("unexpected end of statement", expr, assignStart + 1);
      }

      this.offset = offset - (this.start - start);

      if ((fields & COMPILE_IMMEDIATE) != 0) {
        this.egressType = (statement = (ExecutableStatement)
            subCompileExpression(expr, this.start, this.offset, pCtx)).getKnownEgressType();
      }

      if (col = ((endOfName = findFirst('[', 0, this.varName.length(), indexTarget = this.varName.toCharArray())) > 0)) {
        if (((this.fields |= COLLECTION) & COMPILE_IMMEDIATE) != 0) {
          accExpr = (CompiledAccExpression) compileSetExpression(indexTarget, pCtx);
        }

        this.varName = new String(expr, start, endOfName);
        index = new String(indexTarget, endOfName, indexTarget.length - endOfName);
      }


      try {
        checkNameSafety(this.varName);
      }
      catch (RuntimeException e) {
        throw new CompileException(e.getMessage(), expr, start);
      }
    }
    else {
      try {
        checkNameSafety(this.varName = new String(expr, start, offset));
        this.assignmentVar = varName;
      }
      catch (RuntimeException e) {
        throw new CompileException(e.getMessage(), expr, start);
      }
    }

    if ((fields & COMPILE_IMMEDIATE) != 0) {
      pCtx.addVariable(this.varName, egressType);
View Full Code Here

    if (col) {
      return accExpr.setValue(ctx, thisValue, factory, statement.getValue(ctx, thisValue, factory));
    }
    else if (statement != null) {
      if (factory == null)
        throw new CompileException("cannot assign variables; no variable resolver factory available", expr, start);
      return factory.createVariable(varName, statement.getValue(ctx, thisValue, factory)).getValue();
    }
    else {
      if (factory == null)
        throw new CompileException("cannot assign variables; no variable resolver factory available", expr, start);
      factory.createVariable(varName, null);
      return null;
    }
  }
View Full Code Here

        if (canCast(statement.getKnownEgressType(), cast)) {
          widen = true;
        }
        else {
          throw new CompileException("unable to cast type: "
              + statement.getKnownEgressType() + "; to: " + cast, expr, start);
        }
      }
    }
  }
View Full Code Here

      else {
        return true;
      }
    }
    catch (ClassCastException e) {
      throw new CompileException("assertion does not contain a boolean statement", expr, start);
    }
  }
View Full Code Here

      else {
        return true;
      }
    }
    catch (ClassCastException e) {
      throw new CompileException("assertion does not contain a boolean statement", expr, start);
    }
  }
View Full Code Here

      this.assignmentVar = name;

      this.start = skipWhitespace(expr, assignStart + 1);

      if (this.start >= start + offset) {
        throw new CompileException("unexpected end of statement", expr, assignStart + 1);
      }

      this.offset = offset - (this.start - start);
      stmt = subset(expr, this.start, this.offset);
View Full Code Here

  public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
    PrototypalFunctionInstance instance = new PrototypalFunctionInstance(this, new MapVariableResolverFactory());
    if (name != null) {
      if (!factory.isIndexedFactory() && factory.isResolveable(name))
        throw new CompileException("duplicate function: " + name, expr, start);

      factory.createVariable(name, instance);
    }
    return instance;
  }
View Full Code Here

TOP

Related Classes of org.mvel2.CompileException

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.