Package org.mvel2

Examples of org.mvel2.CompileException


        catch (UnresolveablePropertyException e) {
            vr = null;
        }
        if (vr != null && vr.getType() != null) {
            throw new CompileException("variable already defined within scope: " + vr.getType() + " " + name);
        }
        else {
            return addResolver(name, new LocalVariableResolver(this, name, type), value);
        }
View Full Code Here


        catch (UnresolveablePropertyException e) {
            vr = null;
        }
        if (vr != null && vr.getType() != null) {
            throw new CompileException("variable already defined within scope: " + vr.getType() + " " + name);
        }
        else {
            return addResolver(name, new LocalVariableResolver(this, name), value);
        }
    }
View Full Code Here

        catch (UnresolveablePropertyException e) {
            vr = null;
        }
        if (vr != null && vr.getType() != null) {
            throw new CompileException("variable already defined within scope: " + vr.getType() + " " + name);
        }
        else {
            return addResolver(name, new LocalVariableResolver(this, name, type), value);
        }
View Full Code Here

        }
    }

    public static void copyErrorLocation(Exception e, BaseDescr descr) {
        if (e instanceof CompileException) {
            CompileException compileException = (CompileException)e;
            compileException.setLineNumber(descr.getLine());
            compileException.setColumn(descr.getColumn());
        }
    }
View Full Code Here

    }

    public void setValue(Object value) {
        if (knownType != null && value != null && value.getClass() != knownType) {
            if (!DataConversion.canConvert(knownType, value.getClass())) {
                throw new CompileException("cannot assign " + value.getClass().getName() + " to type: "
                        + knownType.getName());
            }
            try {
                value = DataConversion.convert(value, knownType);
            }
            catch (Exception e) {
                throw new CompileException("cannot convert value of " + value.getClass().getName()
                        + " to: " + knownType.getName());
            }
        }
       
        this.factory.setLocalValue( this.name, value );
View Full Code Here

        catch (UnresolveablePropertyException e) {
            vr = null;
        }
        if (vr != null && vr.getType() != null) {
            throw new CompileException("variable already defined within scope: " + vr.getType() + " " + name);
        }
        else {
            return addResolver(name, new LocalVariableResolver(this, name), value);
        }
    }
View Full Code Here

        catch (UnresolveablePropertyException e) {
            vr = null;
        }
        if (vr != null && vr.getType() != null) {
            throw new CompileException("variable already defined within scope: " + vr.getType() + " " + name);
        }
        else {
            return addResolver(name, new LocalVariableResolver(this, name, type), value);
        }
View Full Code Here

            case '\'':
                return '\'';
            case '"':
                return '\"';
            default:
                throw new CompileException("illegal escape sequence: " + c);
        }
    }
View Full Code Here

              }
            }

          }
          catch (ClassCastException e) {
            throw new CompileException("cannot construct object: " + typeDescr.getClassName()
                + " is not a class reference", expr, start, e);
          }
        }
      }
View Full Code Here

          }

          Constructor cns = getBestConstructorCandidate(parms, cls, false);

          if (cns == null)
            throw new CompileException("unable to find constructor for: " + cls.getName(), expr, start);

          for (int i = 0; i < parms.length; i++) {
            //noinspection unchecked
            parms[i] = convert(parms[i], cns.getParameterTypes()[i]);
          }

          if (cnsRes.length > 1) {
            return PropertyAccessor.get(cnsRes[1], cns.newInstance(parms), factory, thisValue, pCtx);
          }
          else {
            return cns.newInstance(parms);
          }
        }
        else {
          Constructor<?> cns = Class.forName(typeDescr.getClassName(), true, pCtx.getParserConfiguration().getClassLoader())
              .getConstructor(EMPTYCLS);

          if (cnsRes.length > 1) {
            return PropertyAccessor.get(cnsRes[1], cns.newInstance(), factory, thisValue, pCtx);
          }
          else {
            return cns.newInstance();
          }
        }
      }
    }
    catch (CompileException e) {
      throw e;
    }
    catch (ClassNotFoundException e) {
      throw new CompileException("unable to resolve class: " + e.getMessage(), expr, start, e);
    }
    catch (NoSuchMethodException e) {
      throw new CompileException("cannot resolve constructor: " + e.getMessage(), expr, start, e);
    }
    catch (Exception e) {
      throw new CompileException("could not instantiate class: " + e.getMessage(), expr, start, e);
    }
  }
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.