Package railo.transformer.cfml.evaluator

Examples of railo.transformer.cfml.evaluator.EvaluatorException


    while(it.hasNext()) {
      stat=it.next();
      if(stat instanceof Tag) {
        tlt = ((Tag)stat).getTagLibTag();
        if(!tlt.getTagClassName().equals("railo.runtime.tag.Argument"))
          throw new EvaluatorException("tag "+tlt.getFullName()+" is not allowed inside a function declaration");
      }
      /*else if(stat instanceof PrintOut) {
        //body.remove(stat);
      }*/
    }
 
View Full Code Here


    }
  }

  private void checkAttributeValue(Tag tag, Attribute attr) throws EvaluatorException {
    if(!(attr.getValue() instanceof Literal))
      throw new EvaluatorException("Attribute ["+attr.getName()+"] of the Tag ["+tag.getFullname()+"] must be a literal/constant value");
       
    }
View Full Code Here

    String ns=libTag.getTagLib().getNameSpaceAndSeparator();
      String httpName=ns+"http";
   
    // check if tag is direct inside if
    if(!ASMUtil.hasAncestorTag(tag,httpName))
      throw new EvaluatorException("Wrong Context, tag "+libTag.getFullName()+" must be inside a "+httpName+" tag")
  }
View Full Code Here

    String ns=libTag.getTagLib().getNameSpaceAndSeparator();
      String name=ns+"storedproc";
   
    // check if tag is direct inside if
    if(!ASMUtil.hasAncestorTag(tag,name))
      throw new EvaluatorException("Wrong Context, tag "+libTag.getFullName()+" must be inside a "+name+" tag")
  }
View Full Code Here

  public void evaluate(Tag tag,TagLibTag tagLibTag,FunctionLib[] flibs) throws EvaluatorException {
    TagLoop loop=(TagLoop) tag;
   
    // attribute maxrows and endrow not allowd at the same time
        if(tag.containsAttribute("maxrows") && tag.containsAttribute("endrow"))
          throw new EvaluatorException("Wrong Context, you cannot use attribute maxrows and endrow at the same time.");
       
    // file loop     
        if(tag.containsAttribute("file")) {
            if(!tag.containsAttribute("index") && !tag.containsAttribute("item"))
                throw new EvaluatorException("Wrong Context, when you use attribute file you must also use attribute index and/or item");
            loop.setType(TagLoop.TYPE_FILE);
            return;
        }
        // list loop
        if(tag.containsAttribute("list")){
      if(!tag.containsAttribute("index") && !tag.containsAttribute("item"))
        throw new EvaluatorException("Wrong Context, when you use attribute list,you must define attribute index and/or item");
      loop.setType(TagLoop.TYPE_LIST);
            return;
    }
        // array loop
        if(tag.containsAttribute("array")){
      if(!tag.containsAttribute("index") && !tag.containsAttribute("item"))
        throw new EvaluatorException("Wrong Context, when you use attribute array, you must define attribute index and/or item");
      loop.setType(TagLoop.TYPE_ARRAY);
            return;
    }
        // collection loop     
        if(tag.containsAttribute("collection")) {
          if(!tag.containsAttribute("index") && !tag.containsAttribute("item"))
        throw new EvaluatorException("Wrong Context, when you use attribute collection,you must define attribute index and/or item");
      loop.setType(TagLoop.TYPE_COLLECTION);
            return;
        }
    // index loop 
    if(tag.containsAttribute("index")) {
      if(!tag.containsAttribute("from") || !tag.containsAttribute("to"))
        throw new EvaluatorException("Wrong Context, when you use attribute index you must also use attribute from and to or list or file");
      loop.setType(TagLoop.TYPE_INDEX);
            return;
    }
    // condition loop
    if(tag.containsAttribute("condition")){
      if(tag.isScriptBase())
        throw new EvaluatorException("tag loop-condition is not supported within cfscript, use instead a while statement.");
     
      TagLib tagLib=tagLibTag.getTagLib();
      ExprTransformer transformer;
      String text=ASMUtil.getAttributeString(tag, "condition");

      try {
        ConfigImpl config=(ConfigImpl) ThreadLocalPageContext.getConfig();
        transformer = tagLib.getExprTransfomer();
        Expression expr=transformer.transform(ASMUtil.getAncestorPage(tag),null,flibs,config.getCoreTagLib().getScriptTags(),new CFMLString(text,"UTF-8"),TransfomerSettings.toSetting(ThreadLocalPageContext.getConfig(),null));
        tag.addAttribute(new Attribute(false,"condition",CastBoolean.toExprBoolean(expr),"boolean"));
      }
      catch (Exception e) {
        throw new EvaluatorException(e.getMessage());
      }
      loop.setType(TagLoop.TYPE_CONDITION);
            return;
    }
    // query loop
View Full Code Here

  // check parent
    String ns=libTag.getTagLib().getNameSpaceAndSeparator();
    String mailName=ns+"mail";
   
    if(!ASMUtil.hasAncestorTag(tag,mailName))
      throw new EvaluatorException("Wrong Context, tag "+libTag.getFullName()+" must be inside a "+mailName+" tag");
  }
View Full Code Here

      // check attribute passby
      Attribute attrPassBy = tag.getAttribute("passby");
      if(attrPassBy!=null) {
        ExprString expr = CastString.toExprString(attrPassBy.getValue());
        if(!(expr instanceof LitString))
          throw new EvaluatorException("Attribute passby of the Tag Argument, must be a literal string");
        LitString lit = (LitString)expr;
        String passBy = lit.getString().toLowerCase().trim();
        if(!"value".equals(passBy) && !"ref".equals(passBy) && !"reference".equals(passBy))
          throw new EvaluatorException("Attribute passby of the Tag Argument has an invalid value ["+passBy+"], valid values are [reference,value]");
      }
       
      // check if tag is direct inside function
      if(!ASMUtil.isParentTag(tag,functionName)) {
          Tag parent=ASMUtil.getParentTag(tag);
         
          String addText=(parent!=null)?
                  "but tag "+libTag.getFullName()+" is inside tag "+parent.getFullname()+"":
                  "but tag "+libTag.getFullName()+" has no parent";
         
        throw new EvaluatorException("Wrong Context, tag "+libTag.getFullName()
                +" must be direct inside a "+functionName+" tag, "+addText);
      }
      // TODO check if there is a tag other than argument and text before 
     
    }
View Full Code Here

    if(eval!=null) return eval;
    try {
      eval = (Evaluator) ClassUtil.loadInstance(tteClass);
    }
    catch (ClassException e) {
      throw new EvaluatorException(e.getMessage());
    }
    return eval;
  }
View Full Code Here

    }
   
    if(!ASMUtil.hasAncestorContinueFCStatement(tag,label)) {
      if(tag.isScriptBase()) {
        if(StringUtil.isEmpty(label))
          throw new EvaluatorException("Wrong Context, "+libTag.getName()+" must be inside a loop (for,while,loop ...)");
        throw new EvaluatorException("Wrong Context, "+libTag.getName()+" must be inside a loop (for,while,loop ...) with the label ["+label+"]");
       
      }
      if(StringUtil.isEmpty(label))
        throw new EvaluatorException("Wrong Context, tag "+libTag.getFullName()+" must be inside a "+loopName+" or "+whileName+" tag");
      throw new EvaluatorException("Wrong Context, tag "+libTag.getFullName()+" must be inside a "+loopName+" or "+whileName+" tag with the label ["+label+"]");
     
    }
  }
View Full Code Here

    String ns=libTag.getTagLib().getNameSpaceAndSeparator();
      String name=ns+"storedproc";
   
    // check if tag is direct inside if
    if(!ASMUtil.hasAncestorTag(tag,name))
      throw new EvaluatorException("Wrong Context, tag "+libTag.getFullName()+" must be inside a "+name+" tag")
  }
View Full Code Here

TOP

Related Classes of railo.transformer.cfml.evaluator.EvaluatorException

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.