Package railo.runtime.exp

Examples of railo.runtime.exp.TemplateException


    int start=cfml.getPos();
    short counter=1;
    while(true) {
      if(cfml.isAfterLast()) {
        cfml.setPos(start);
        throw new TemplateException(cfml,"no end comment found");
      }
      else if(cfml.forwardIfCurrent("<!---")) {
        counter++;
      }
      else if(cfml.forwardIfCurrent("--->")) {
View Full Code Here


            PrintOut po;
            parent.addStatement(po=new PrintOut(transformer.transform(data.page,data.ep,data.flibs,data.scriptTags,data.cfml,data.settings),line,null));
            po.setEnd(data.cfml.getPosition());
           
            if(!data.cfml.isCurrent('#'))
              throw new TemplateException(data.cfml,"missing terminating [#] for expression");
          }
        }
        else if(data.cfml.isCurrent('<') && count>1) {
          break;
        }
View Full Code Here

       if(tagLibTag==null) {
         if(tagLib.getIgnoreUnknowTags()){
           data.cfml.setPos(start);
           return false;
         }
         throw new TemplateException(data.cfml,"undefined tag ["+tagLib.getNameSpaceAndSeparator()+strName+"]");
       }
      appendix=StringUtil.removeStartingIgnoreCase(strNameNormal,tagLibTag.getName());
     }
   
    // CFXD Element
    Tag tag;
    try {
      tag = tagLibTag.getTag(line,data.cfml.getPosition());
    }
    catch (Exception e) {
      throw new TemplateException(data.cfml,e);
    }
    parent.addStatement(tag);
   
    // get tag from tag library
     if(appendix!=null)  {
      tag.setAppendix(appendix);
      tag.setFullname(tagLibTag.getFullName().concat(appendix));
     }
     else {
       tag.setFullname(tagLibTag.getFullName());    
     }
     if(tag.getFullname().equalsIgnoreCase("cfcomponent"))data.page.setIsComponent(true)// MUST to hardcoded, to better
     else if(tag.getFullname().equalsIgnoreCase("cfinterface"))data.page.setIsInterface(true)// MUST to hardcoded, to better
      
    tag.setTagLibTag(tagLibTag);
    comment(data.cfml,true);
   
    // Tag Translator Evaluator
    if(tagLibTag.hasTteClass())  {
      data.ep.add(tagLibTag,tag,data.flibs,data.cfml);
    }
   
    //get Attributes
    attributes(data,tagLibTag,tag);
   
    if(tagLibTag.hasAttributeEvaluator()) {
      try {
        tagLibTag=tagLibTag.getAttributeEvaluator().evaluate(tagLibTag,tag);
      } catch (AttributeEvaluatorException e) {
       
        throw new TemplateException(data.cfml, e);
      }
    }
   
   
   
    // End of begin Tag
//    TODO muss erlaubt sein
    if(data.cfml.forwardIfCurrent('>'))  {
      hasBody=tagLibTag.getHasBody();
    }
    else if(data.cfml.forwardIfCurrent('/','>')) {
      if(tagLibTag.getHasBody())tag.setBody(new BodyBase());
    }
    else {
      throw createTemplateException(data.cfml, "tag ["+tagLibTag.getFullName()+"] is not closed",tagLibTag);
    }
   

    // Body
    if(hasBody)  {

       
      // get Body
      if(tagLibTag.isTagDependent()) {
        // get TagDependentBodyTransformer
        TagDependentBodyTransformer tdbt=null;
        try {
          tdbt=tagLibTag.getBodyTransformer();
        } catch (TagLibException e) {
          throw new TemplateException(data.cfml,e);
        }
        if(tdbt==null) throw createTemplateException(data.cfml,"Tag dependent body Transformer is invalid for Tag ["+tagLibTag.getFullName()+"]",tagLibTag);
        tdbt.transform(data.page,this,data.ep,data.flibs,tag,tagLibTag,data.scriptTags,data.cfml,data.settings);
       
        //  get TagLib of end Tag
        if(!data.cfml.forwardIfCurrent("</")) {
          // MUST this is a patch, do a more proper implementation
          TemplateException te = new TemplateException(data.cfml,"invalid construct");
          if(tdbt instanceof CFMLScriptTransformer && ASMUtil.containsComponent(tag.getBody())) {
            throw new CFMLScriptTransformer.ComponentTemplateException(te);
          }
          throw te;
        }
       
        TagLib tagLibEnd=nameSpace(data);
        // same NameSpace
        if(!(tagLibEnd!=null && tagLibEnd.getNameSpaceAndSeparator().equals(tagLib.getNameSpaceAndSeparator())))
          throw new TemplateException(data.cfml,"invalid construct");
        // get end Tag
        String strNameEnd=identifier(data.cfml,true).toLowerCase();

        // not the same name Tag
        if(!strName.equals(strNameEnd)) {
          data.cfml.setPos(start);
          throw new TemplateException(data.cfml,"Start and End Tag has not the same Name ["+tagLib.getNameSpaceAndSeparator()+strName+"-"+tagLibEnd.getNameSpaceAndSeparator()+strNameEnd+"]");       
         }
         data.cfml.removeSpace();
         if(!data.cfml.forwardIfCurrent('>'))
           throw new TemplateException(data.cfml,"End Tag ["+tagLibEnd.getNameSpaceAndSeparator()+strNameEnd+"] not closed");
      }
      else {
        // get body of Tag
        BodyBase body=new BodyBase();
        body.setParent(tag);
        //tag.setBody(body);
          //parseExpression=(tagLibTag.getParseBody())?true:parseExpression;
        if(tagLibTag.getParseBody())parseExpression=true;
       
        while(true)  {
         
          // Load Expession Transformer from TagLib
          ExprTransformer transfomer=null;
          if(parseExpression) {
            try {
              transfomer = tagLibTag.getTagLib().getExprTransfomer();
            } catch (TagLibException e) {
              throw new TemplateException(data.cfml,e);
            }
          }
         

          // call body
         
            body(data,body,parseExpression,transfomer);
          
           
            // no End Tag
          if(data.cfml.isAfterLast()) {
             
            if(tagLibTag.isBodyReq()) {
                data.cfml.setPos(start);
              throw createTemplateException(data.cfml,"No matching end tag found for tag ["+tagLibTag.getFullName()+"]",tagLibTag);
            }
            body.moveStatmentsTo(parent);
            return executeEvaluator(data,tagLibTag, tag);
          }
         
          // Invalid Construct
          int posBeforeEndTag=data.cfml.getPos();
          if(!data.cfml.forwardIfCurrent('<','/'))
            throw createTemplateException(data.cfml,"Missing end tag for ["+tagLibTag.getFullName()+"]",tagLibTag);
         
          // get TagLib of end Tag
          int _start = data.cfml.getPos();
          TagLib tagLibEnd=nameSpace(data);
         
          // same NameSpace
          if(tagLibEnd!=null)  {
              String strNameEnd="";
              //railo.print.ln(data.cfml.getLine()+" - "+data.cfml.getColumn()+" - "+tagLibEnd.getNameSpaceAndSeperator()+".equals("+tagLib.getNameSpaceAndSeperator()+")");
              if(tagLibEnd.getNameSpaceAndSeparator().equals(tagLib.getNameSpaceAndSeparator())) {
                 
                // get end Tag
              strNameEnd=identifier(data.cfml,true).toLowerCase();
              // not the same name Tag
             
              // new part
              data.cfml.removeSpace();
              if(strName.equals(strNameEnd)) {
                  if(!data.cfml.forwardIfCurrent('>'))
                  throw new TemplateException(data.cfml,"End Tag ["+tagLibEnd.getNameSpaceAndSeparator()+strNameEnd+"] not closed");
                break;
              }
             
              }
              // new part
              if(tagLibTag.isBodyReq()) {
              TagLibTag endTag = tagLibEnd.getTag(strNameEnd);
              if(endTag!=null && !endTag.getHasBody())
                throw new TemplateException(data.cfml,
                    "End Tag ["+
                    tagLibEnd.getNameSpaceAndSeparator()+strNameEnd+"] is not allowed, for this tag only a Start Tag is allowed");
              data.cfml.setPos(start);
              if(tagLibEnd.getIgnoreUnknowTags() && (tagLibEnd.getTag(strNameEnd))==null){
                data.cfml.setPos(_start);
              }
              else throw new TemplateException(data.cfml,
                  "Start and End Tag has not the same Name ["+
                  tagLib.getNameSpaceAndSeparator()+strName+"-"+tagLibEnd.getNameSpaceAndSeparator()+strNameEnd+"]");
            }
              else {
              body.moveStatmentsTo(parent);
View Full Code Here

                    newTlibs[data.tlibs[TAG_LIB_PAGE].length]=lib;
                    data.tlibs[TAG_LIB_PAGE]=newTlibs;   
        }
      }
            catch (EvaluatorException e) {
                throw new TemplateException(data.cfml,e);
            }
    }
    return true;
  }
View Full Code Here

      // mixed in a noname attribute
      if(StringUtil.isEmpty(name)){
        allowDefaultValue.setValue(false);
        TagLibTagAttr attr = tag.getDefaultAttribute();
        if(attr==null)
          throw new TemplateException(data.cfml,"Invalid Identifier.");
        name=attr.getName();
        sbType.append(attr.getType());
        isDefaultValue=true;
      }
     
View Full Code Here

      else expr=transfomer.transformAsString(data.page,data.ep,data.flibs,data.scriptTags,data.cfml,data.settings,true);
      if(type.length()>0) {
        expr=CastOther.toExpression(expr, type);
      }
    } catch (TagLibException e) {
      throw new TemplateException(data.cfml,e);
    }
    return expr;
  }
View Full Code Here

   * @throws TemplateException
   */
  public static String identifier(CFMLString cfml,boolean throwError) throws TemplateException  {
    int start = cfml.getPos();
    if(!cfml.isCurrentBetween('a','z') && !cfml.isCurrent('_')) {
      if(throwError)throw new TemplateException(cfml,"Invalid Identifier.");
      return null;
    }
    do {
      cfml.next();
      if(!(cfml.isCurrentBetween('a','z')
View Full Code Here

    return cfml.substring(start,cfml.getPos()-start);
  }
 
 
  public static TemplateException createTemplateException(CFMLString cfml,String msg, String detail,TagLibTag tag) {
    TemplateException te = new TemplateException(cfml,msg,detail);
    setAddional(te,tag);
    return te;
  }
View Full Code Here

    TemplateException te = new TemplateException(cfml,msg,detail);
    setAddional(te,tag);
    return te;
  }
  public static TemplateException createTemplateException(CFMLString cfml,String msg, TagLibTag tag) {
    TemplateException te = new TemplateException(cfml,msg);
    setAddional(te,tag);
    return te;
  }
View Full Code Here

            ec.getTag(),
            ec.getLibTag(),
            ec.getFlibs());
      } catch (EvaluatorException e) {
          v.clear();//print.printST(e);
        throw new TemplateException(cfml,e);
      }catch (Throwable e) {
          v.clear();
        throw new TemplateException(cfml,e);
      }
     
    }
    v.clear();
  }
View Full Code Here

TOP

Related Classes of railo.runtime.exp.TemplateException

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.