Package railo.runtime.exp

Examples of railo.runtime.exp.TemplateException


      }
    }   


    if(!cfml.forwardIfCurrent(quoter))
      throw new TemplateException(cfml,"Invalid Syntax Closing ["+quoter+"] not found");
 
    LitString rtn = new LitString(str.toString(),line,cfml.getPosition());
    cfml.removeSpace();
    return rtn;
  }
View Full Code Here


    StringBuffer sb=new StringBuffer();
    Position line = cfml.getPosition();
    while(cfml.isValidIndex()) {
      if(cfml.isCurrent(' ') || cfml.isCurrent('>') || cfml.isCurrent("/>")) break;
      else if(cfml.isCurrent('"') || cfml.isCurrent('#') || cfml.isCurrent('\'')) {
        throw new TemplateException(cfml,"simple attribute value can't contain ["+cfml.getCurrent()+"]");
      }
      else sb.append(cfml.getCurrent());
      cfml.next();
    }
    cfml.removeSpace();
View Full Code Here

      sb.append(cfml.getCurrent());
      cfml.next();
    }
    //int endline=cfml.getLine();
    if(cfml.isAfterLast())
      throw new TemplateException(cfml,"missing end tag"); // TODO better error message
   
   
    if(true) throw new RuntimeException("not implemented");
    //MUST add again String dummyStart="public class Susi {public static void code(){"+StringUtil.repeatString("\n", startline-1);
   
    //MUST add again String dummyEnd="}}";
    //MUST add again String src=dummyStart+sb+dummyEnd;
    //MUST add again Label start=new Label();
    //MUST add again Label end=new Label();
   
    //MUST add again ByteArrayInputStream bais = new ByteArrayInputStream(src.getBytes());
   
    try {
      //MUST add again CompilationUnit cu = JavaParser.parse(bais);
      //MUST add again DataBag db = new DataBag();
      ScriptBody body=new ScriptBody();
      tag.setBody(body);
      //MUST add again new JavaParserVisitor(body,start,end).visit(cu, db);
     
    }
    catch (Exception e) {
      throw new TemplateException(cfml,e);
    }
  }
View Full Code Here

  throws TemplateException {
    Attribute attr = tag.getAttribute("language");
    if(attr!=null) {
      Expression expr = CastString.toExprString(attr.getValue());
      if(!(expr instanceof LitString))
        throw new TemplateException(cfml,"Attribute language of the Tag script, must be a literal string value");
      String str = ((LitString)expr).getString().trim();
      if("java".equalsIgnoreCase(str))    jst.transform(page,parent, ep, flibs, tag, tagLibTag,scriptTags, cfml,settings);
      else if("cfml".equalsIgnoreCase(str))  cst.transform(page,parent, ep, flibs, tag, tagLibTag,scriptTags, cfml,settings);
      else
        throw new TemplateException(cfml,"invalid value for attribute language from tag script ["+str+"], valid values are [cfml,java]");
    }
  }
View Full Code Here

    Attribute t = tag.getAttribute("taglib");
    Attribute path = tag.getAttribute("path");
   
    if(p!=null || t!=null){
      if(p==null)
        throw new TemplateException(data.cfml,"Wrong Context, missing attribute [prefix] for tag "+tag.getFullname());
      if(t==null)
        throw new TemplateException(data.cfml,"Wrong Context, missing attribute [taglib] for tag "+tag.getFullname());
     
      if(path!=null)
        throw new TemplateException(data.cfml,"Wrong context, you have an invalid attributes constellation for the tag "+tag.getFullname()+", " +
            "you cannot mix attribute [path] with attributes [taglib] and [prefix]");
     
      return executePT(config, tag, libTag, flibs, data.cfml);
    }
    if(path==null) throw new TemplateException(data.cfml,"Wrong context, you have an invalid attributes constellation for the tag "+tag.getFullname()+", " +
        "you need to define the attributes [prefix] and [taglib], the attribute [path] or simply define a attribute value");
   
    String strPath=ASMUtil.getAttributeString(tag,"path",null);
        if(strPath==null) throw new TemplateException(data.cfml,"attribute [path] must be a constant value");
        ti.setPath(strPath);
       
    return null;
   
  }
View Full Code Here

 
    private TagLib executePT(Config config,Tag tag, TagLibTag libTag, FunctionLib[] flibs,CFMLString cfml) throws TemplateException {
     
        // Attribute prefix
        String nameSpace=ASMUtil.getAttributeString(tag,"prefix",null);
        if(nameSpace==null) throw new TemplateException(cfml,"attribute [prefix] must be a constant value");
        nameSpace=nameSpace.trim();
        String nameSpaceSeparator=StringUtil.isEmpty(nameSpace)?"":":";
       
       
        // Attribute taglib 
        String textTagLib=ASMUtil.getAttributeString(tag,"taglib",null);
        if(textTagLib==null) throw new TemplateException(cfml,"attribute [taglib] must be a constant value");
       
        textTagLib=textTagLib.replace('\\','/');
        textTagLib=ConfigWebUtil.replacePlaceholder(textTagLib, config);
        // File TagLib
        String ext=ResourceUtil.getExtension(textTagLib,null);
        boolean hasTldExtension="tld".equalsIgnoreCase(ext);
       
        Resource absFile=config.getResource(textTagLib);
      // TLD
    if(absFile.isFile()) return _executeTLD(config,absFile,nameSpace,nameSpaceSeparator,cfml);
    // CTD
    //else if(absFile.isDirectory()) return _executeCTD(absFile,textPrefix);
   
       
    // Second Change     
    if(textTagLib.startsWith("/")){
            //config.getPhysical(textTagLib);
        PageSource ps = ((ConfigImpl)config).getPageSourceExisting(null,null,textTagLib,false,false,true,false);
       
        //config.getConfigDir()
        if(ps!=null) {
            if(ps.physcalExists()) {
              Resource file = ps.getPhyscalFile();
          // TLD
              if(file.isFile()) return _executeTLD(config,file,nameSpace,nameSpaceSeparator,cfml);
            }
        // CTD
        if(!hasTldExtension)return _executeCTD(textTagLib,nameSpace,nameSpaceSeparator);
        }
    }
    else {
      Resource sourceFile=cfml.getSourceFile().getPhyscalFile();
        if(sourceFile!=null) {
          Resource file = sourceFile.getParentResource().getRealResource(textTagLib);
        // TLD
            if(file.isFile()) return _executeTLD(config,file,nameSpace,nameSpaceSeparator,cfml);
        // CTD
            if(!hasTldExtension)return _executeCTD(textTagLib,nameSpace,nameSpaceSeparator);
        }
    }
      throw new TemplateException(cfml,"invalid definition of the attribute taglib ["+textTagLib+"]");
    }
View Full Code Here

            taglib.setNameSpaceSeperator(nameSpaceSeparator);
            return taglib;
        }
        catch (TagLibException e) {
         
            throw new TemplateException(cfml,e.getMessage());
        }
    }
View Full Code Here

    Position line = data.cfml.getPosition();
   
    Body body=new BodyBase();
    Condition cont=new Condition(condition(data),body,line,null);
   
    if(!data.cfml.forwardIfCurrent(')')) throw new TemplateException(data.cfml,"if statement must end with a [)]");
    // ex block
    statement(data,body,CTX_IF);
    // else if
    comments(data);
    while(elseifStatement(data,cont)) {
View Full Code Here

    Position line = data.cfml.getPosition();
    Body body=new BodyBase();
    Pair pair = cont.addElseIf(condition(data), body, line,null);

    if(!data.cfml.forwardIfCurrent(')'))
      throw new TemplateException(data.cfml,"else if statement must end with a [)]");
    // ex block
    statement(data,body,CTX_ELSE_IF);
    pair.end=data.cfml.getPosition();
    return true;
  }
View Full Code Here

    Position line = data.cfml.getPosition();
    Body body=new BodyBase();
    While whil=new While(condition(data),body,line,null,id);
   
    if(!data.cfml.forwardIfCurrent(')'))
      throw new TemplateException(data.cfml,"while statement must end with a [)]");
   
    statement(data,body,CTX_WHILE);
    whil.setEnd(data.cfml.getPosition());
    return whil;
  }
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.