Package railo.runtime.exp

Examples of railo.runtime.exp.TemplateException


    try {
      Tag tag = tlt.getTag(start, end);
      tag.setParent(parent);
      return tag;
    } catch (TagLibException e) {
      throw new TemplateException(data.cfml,e);
    }
    /*if(StringUtil.isEmpty(tlt.getTttClassName()))tag= new TagBase(line);
    else {
      try {
        Class<Tag> clazz = ClassUtil.loadClass(tlt.getTttClassName());
View Full Code Here


  private final boolean checkSemiColonLineFeed(ExprData data,boolean throwError, boolean checkNLBefore) throws TemplateException {
    comments(data);
    if(!data.cfml.forwardIfCurrent(';')){
      if((!checkNLBefore || !data.cfml.hasNLBefore()) && !data.cfml.isCurrent("</",data.tagName) && !data.cfml.isCurrent('}')){
        if(!throwError) return false;
        throw new TemplateException(data.cfml,"Missing [;] or [line feed] after expression");
      }
    }
    return true;
  }
View Full Code Here

       
           
      if(sbType.length()==0) {
          type=string(data);
          if(type==null)         
              throw new TemplateException(data.cfml,"a catch statement must begin with the throwing type (query, application ...).");
      }
      else {
        type=LitString.toExprString(sbType.toString());
      }
           
           
      //name = expression();
      comments(data);
     
      // name
      if(!data.cfml.isCurrent(')')) {
        name=expression(data);
      }
      else {
        data.cfml.setPos(pos);
        name=expression(data);
        type = LitString.toExprString( "any" );
      }
      comments(data);

            Body b=new BodyBase();
      try {
        tryCatchFinally.addCatch(type,name,b,line);
      }
      catch (BytecodeException e) {
        throw new TemplateException(data.cfml,e.getMessage());
      }
      comments(data);
     
      if(!data.cfml.forwardIfCurrent(')')) throw new TemplateException(data.cfml,"invalid catch statement, missing closing )");
     
            statement(data,b,CTX_CATCH);
      comments(data)
    }
       
   
// finally
     if(finallyStatement(data,tryCatchFinally)) {
      comments(data);
     }
     else if(catchCount==0)
      throw new TemplateException(data.cfml,"a try statement must have at least one catch statement");
   
        //if(body.isEmpty()) return null;
    tryCatchFinally.setEnd(data.cfml.getPosition());
    return tryCatchFinally;
  }
View Full Code Here

      return true;
    }
    statements(data,body,false);
   
    if(!data.cfml.forwardIfCurrent('}'))
      throw new TemplateException(data.cfml,"Missing ending [}]");
    return true;
 
View Full Code Here

        Iterator<String> it = hash.keySet().iterator();
       
        while(it.hasNext())  {
          TagLibTagAttr att=hash.get(it.next());
          if(att.isRequired() && !contains(attrs,att.getName()) && att.getDefaultValue()==null && !att.getName().equals(ignoreAttrReqFor))  {
            if(!hasAttributeCollection)throw new TemplateException(data.cfml,"attribute "+att.getName()+" is required for statement "+tlt.getName());
            if(tag!=null)tag.addMissingAttribute(att.getName(),att.getType());
          }
        }
      }
    }
View Full Code Here

  }
 
 
 
  private final String validateAttributeName(String id,CFMLString cfml, ArrayList<String> args,TagLibTag tag, RefBoolean dynamic, StringBuffer sbType, boolean allowTwiceAttr) throws TemplateException {
    if(args.contains(id) && !allowTwiceAttr) throw new TemplateException(cfml,"you can't use the same attribute ["+id+"] twice");
    args.add(id);
   
   
    if(tag==null) return id;
    int typeDef=tag.getAttributeType();
    if("attributecollection".equals(id)){
      dynamic.setValue(tag.getAttribute(id)==null);
      sbType.append("struct");
    }
    else if(typeDef==TagLibTag.ATTRIBUTE_TYPE_FIXED || typeDef==TagLibTag.ATTRIBUTE_TYPE_MIXED) {
      TagLibTagAttr attr=tag.getAttribute(id);
      if(attr==null) {
        if(typeDef==TagLibTag.ATTRIBUTE_TYPE_FIXED) {
          String names=tag.getAttributeNames();
          if(StringUtil.isEmpty(names))
            throw new TemplateException(cfml,"Attribute "+id+" is not allowed for tag "+tag.getFullName());
         
          throw new TemplateException(cfml,
            "Attribute "+id+" is not allowed for statement "+tag.getName(),
            "valid attribute names are ["+names+"]");
        }
        dynamic.setValue(true);
       
View Full Code Here

      if(ASMUtil.isOverfowMethod(trace.getMethodName())) list.set(0,frame);
      else list.add(0,frame);
     
    }
    if(pe instanceof TemplateException){
      TemplateException te = (TemplateException) pe;
      if(te.getPageSource()!=null)
        list.add(0,new FDStackFrameImpl(null,pc,te.getPageSource(),te.getLine()));
    }
   
    return list;
  }
View Full Code Here

  private OutputStream getOutputStream() throws PageException, IOException {
        try {
          return pageContext.getResponseStream();
        }
        catch(IllegalStateException ise) {
            throw new TemplateException("content is already send to user, flush");
        }
    }
View Full Code Here

      return _compile(config, classRootDir, resetCL);
        }
        catch(ClassFormatError e) {
          String msg=StringUtil.emptyIfNull(e.getMessage());
          if(StringUtil.indexOfIgnoreCase(msg, "Invalid method Code length")!=-1) {
            throw new TemplateException("There is too much code inside the template ["+getDisplayPath()+"], Railo was not able to break it into pieces, move parts of your code to an include or a external component/function",msg);
          }
          throw Caster.toPageException(e);
        }
        catch(Throwable t) {
          throw Caster.toPageException(t);
View Full Code Here

              barr=IOUtil.toBytes(is=ace.getInputStream());
             
              String srcName = ASMUtil.getClassName(barr);
              // source is cfm and target cfc
              if(srcName.endsWith("_cfm$cf") && className.endsWith("_cfc$cf"))
                  throw new TemplateException("source file ["+source.getDisplayPath()+"] contains the bytecode for a regular cfm template not for a component");
              // source is cfc and target cfm
              if(srcName.endsWith("_cfc$cf") && className.endsWith("_cfm$cf"))
                  throw new TemplateException("source file ["+source.getDisplayPath()+"] contains a component not a regular cfm template");
             
              // rename class name when needed
              if(!srcName.equals(className))barr=ClassRenamer.rename(barr, className);
             
             
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.