Package railo.runtime.exp

Examples of railo.runtime.exp.FunctionException


  private static final long serialVersionUID = 6115589794465960484L;

  public static String call(PageContext pc, String strType) throws PageException {
    int type = Util.toType(strType,ConfigImpl.CACHE_DEFAULT_NONE);
    if(type==ConfigImpl.CACHE_DEFAULT_NONE)
      throw new FunctionException(pc,"CacheGetDefaultCacheName",1,"type","invalid type defintion ["+strType+"], valid types are [object,resource,template,query]");
   
    ConfigImpl config=(ConfigImpl) pc.getConfig();
    CacheConnection conn = config.getCacheDefaultConnection(type);
    if(conn==null)
      throw new ExpressionException("there is no default cache defined for type ["+strType+"]");
View Full Code Here


    return call(pc,list,posNumber,value,delimiter,false);
  }
  public static String call(PageContext pc , String list, double posNumber, String value, String delimiter, boolean includeEmptyFields) throws ExpressionException {
   
    if(list.length()==0)
      throw new FunctionException(pc,"listSetAt",1,"list","can't be empty");
   
   
    int pos=((int) posNumber);
    //int[] removedInfo=new int[2];
   
    Array arr = ListUtil.listToArray(list,delimiter);
    int len=arr.size();
   
    // invalid index
    if(pos<1)
      throw new FunctionException(pc,"listSetAt",2,"position","invalid string list index ["+(pos)+"]");
    else if(len<pos) {
      throw new FunctionException(pc,"listSetAt",2,"position","invalid string list index ["+(pos)+"], indexes go from 1 to "+(len));
    }
   
    StringBuffer sb=new StringBuffer();//RepeatString.call(new StringBuffer(),delimiter,removedInfo[0]);
    boolean hasStart=false;
    boolean hasSet=false;
    String v;
    int count=0;
    for(int i=1;i<=len;i++) {
      v=(String)arr.get(i,"");
      if(hasStart) {
        sb.append(delimiter);
      }
      else hasStart=true;
     
      if(includeEmptyFields || v.length()>0)count++;
      if(!hasSet && pos==count) {
        sb.append(value);
        hasSet=true;
      }
      else sb.append(arr.get(i,""));
    }
    if(!hasSet){
      throw new FunctionException(pc,"listSetAt",2,"position","invalid string list index ["+(pos)+"]");
    }
   
   
    return sb.toString();
  }
View Full Code Here

    public static String call(PageContext pc , String scope, String charset) throws PageException {
        scope=scope.trim().toLowerCase();
        try {
            if(scope.equals("url"))(pc.urlScope()).setEncoding(pc.getApplicationContext(),charset);
            else if(scope.equals("form"))(pc.formScope()).setEncoding(pc.getApplicationContext(),charset);
            else throw new FunctionException(pc,"setEncoding",1,"scope","scope must have the one of the following values [url,form] not ["+scope+"]");
           
        } catch (UnsupportedEncodingException e) {
            throw Caster.toPageException(e);
        }
        return ""
View Full Code Here

    try {
      args[0]=oLeft;
      args[1]=oRight;
      Object res = udf.call(pc, args, false);
      Integer i = Caster.toInteger(res,null);
      if(i==null) throw new FunctionException(pc,"ArraySort",2,"function","return value of the "+(udf instanceof Closure?"closure":"function ["+udf.getFunctionName()+"]")+" cannot be casted to a integer.",CasterException.createMessage(res, "integer"));
          return i.intValue();
    }
    catch (PageException pe) {
      throw new PageRuntimeException(pe);
    }
View Full Code Here

   
    ClassLoader cl = ((PageContextImpl)pc).getClassLoader();
    Class[] interfaces=new Class[strInterfaces.length];
    for(int i=0;i<strInterfaces.length;i++){
      interfaces[i]=ClassUtil.loadClass(cl, strInterfaces[i]);
      if(!interfaces[i].isInterface()) throw new FunctionException(pc, "CreateDynamicProxy", 2, "interfaces", "definition ["+strInterfaces[i]+"] is a class and not a interface");
    }
   
    return JavaProxyFactory.createProxy(pc,cfc, null,interfaces);
  }
View Full Code Here

  }
 
  public static String call(PageContext pc , String list, double posNumber, String delimiter, boolean includeEmptyFields) throws PageException {
    int pos=(int) posNumber;
    String rtn = ListUtil.getAt(list,delimiter,pos-1,!includeEmptyFields,null);
    if(rtn==null) throw new FunctionException(pc,"listGetAt",2,"posNumber","invalid string list index ["+pos+"]");
    return rtn;
  }
View Full Code Here

        for(int i=1;i<=len;i++) {
            arr[0]=array.get(i,null);
            if(arr[0]!=null) {
              res=udf.call(pc, arr, false);
              b=Caster.toBoolean(res,null);
              if(b==null) throw new FunctionException(pc,"ArrayFindAll",2,"function","return value of the "+(udf instanceof Closure?"closure":"function ["+udf.getFunctionName()+"]")+" cannot be casted to a boolean value.",CasterException.createMessage(res, "boolean"));
              if(b.booleanValue()) {
                rtn.appendEL(Caster.toDouble(i));
              }
            }
        }
View Full Code Here

    return call(pc, client, nameSpace, name, value,false);
  }
  public static boolean call(PageContext pc, Object client,String nameSpace, String name, Object value, boolean mustUnderstand) throws PageException {
    //if(true)throw new FunctionNotSupported("AddSOAPRequestHeader");
    if(!(client instanceof RPCClient))
      throw new FunctionException(pc, "addSOAPRequestHeader", 1, "webservice", "value must be a webservice Object generated with createObject/<cfobject>");
   
    AxisUtil.addSOAPRequestHeader((RPCClient) client, nameSpace, name, value, mustUnderstand);
    return true;
  }
View Full Code Here

    return call(pc,list,posNumber,value,strDelimiter,false);
  }
   
  public static String call(PageContext pc , String list, double posNumber, String value, String strDelimiter, boolean includeEmptyFields) throws ExpressionException {
    if(strDelimiter.length()==0)
        throw new FunctionException(pc,"listInsertAt",4,"delimiter","invalid delimiter value, can't be a empty string");
       
        return ListUtil.listInsertAt(list,(int)posNumber,value,strDelimiter,!includeEmptyFields);
  }
View Full Code Here

        }
      }
    }
   
    // not a boolean or cacheName
    throw new FunctionException(pc, "cacheGet", 2, "ThrowWhenNotExist", "arguments needs to be a boolean value, but also a valid cacheName is supported for compatibility reasons to other engines");
  }
View Full Code Here

TOP

Related Classes of railo.runtime.exp.FunctionException

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.