Package railo.runtime.exp

Examples of railo.runtime.exp.ApplicationException


   */
  public void setTimeout(double timeout) throws ApplicationException {
   
    this.timeout = (long)(timeout*1000D);
    if(this.timeout<0)
      throw new ApplicationException("attribute timeout must contain a positive number");
    if(timeout==0)timeout=1;
  }
View Full Code Here


        else if(action.equals("update")) doUpdate();
      else if(action.equals("delete")) doDelete();
      else if(action.equals("refresh")) doRefresh();
      else if(action.equals("list")) doList();

      else throw new ApplicationException("invalid action name [" + action + "]","valid action names are [list,update, delete, purge, refresh]");
    } catch (Exception e) {
      throw Caster.toPageException(e);
    }
    return SKIP_BODY;
  }
View Full Code Here

          else if(action.equals("existsfile")) client=actionExistsFile();
          else if(action.equals("exists")) client=actionExists();
          //else if(action.equals("copy")) client=actionCopy();
         
          
          else throw new ApplicationException(
                  "attribute action has an invalid value ["+action+"]",
                  "valid values are [open,close,listDir,createDir,removeDir,changeDir,getCurrentDir," +
                  "getCurrentURL,existsFile,existsDir,exists,getFile,putFile,rename,remove]");

        }
View Full Code Here

   
       
    FTPClient client = getClient();
    Resource local=ResourceUtil.toResourceExistingParent(pageContext ,localfile);//new File(localfile);
        pageContext.getConfig().getSecurityManager().checkFileLocation(local);
    if(failifexists && local.exists()) throw new ApplicationException("File ["+local+"] already exist, if you want to overwrite, set attribute failIfExists to false");
    OutputStream fos=null;
        client.setFileType(getType(local));
        try {
          fos=IOUtil.toBufferedOutputStream(local.getOutputStream());
            client.retrieveFile(remotefile,fos);
View Full Code Here

     * @param atttributValue
   * @throws ApplicationException
     */
    private void required(String attributeName, String atttributValue) throws ApplicationException {
        if(atttributValue==null)
            throw new ApplicationException(
                    "invalid attribute constelation for the tag ftp",
                    "attribute ["+attributeName+"] is required, if action is ["+action+"]");
    }
View Full Code Here

   
    // current
        CFTag current=getCFTag();
        Struct value;
        if(current==null || (value=current.getAttributesScope())==null)
          throw new ApplicationException("invalid context, tag is no inside a custom tag");
       
        // parent
        CFTag parent=GetBaseTagData.getParentCFTag(current.getParent(), basetag, -1);
        if(parent==null) throw new ApplicationException("there is no parent tag with name ["+basetag+"]");
       
        Struct thisTag=parent.getThis();
        Object obj=thisTag.get(datacollection,null);
       
        Array array;
View Full Code Here

      if(StringUtil.isEmpty(destination,true) && !StringUtil.isEmpty(strNewdirectory,true)) {
        destination=strNewdirectory.trim();
      }
      actionCopy(pageContext,directory,destination,serverPassword,createPath,acl,storage,filter,recurse, nameconflict);
    }
    else throw new ApplicationException("invalid action ["+action+"] for the tag directory");
     
    return SKIP_BODY;
  }
View Full Code Here

      else
        rtn=array=new ArrayImpl();
     
      if(!directory.exists()){
        if(directory instanceof FileResource) return rtn;
      throw new ApplicationException("directory ["+directory.toString()+"] doesn't exist");
    }
    if(!directory.isDirectory()){
      if(directory instanceof FileResource) return rtn;
      throw new ApplicationException("file ["+directory.toString()+"] exists, but isn't a directory");
    }
    if(!directory.isReadable()){
      if(directory instanceof FileResource) return rtn;
      throw new ApplicationException("no access to read directory ["+directory.toString()+"]");
    }
   
    long startNS=System.nanoTime();
   
    try {
      // Query All
      if(listInfo==LIST_INFO_QUERY_ALL)
        _fillQueryAll(query,directory,filter,0,hasMeta,recurse);
     
      // Query Name
      else if(listInfo==LIST_INFO_QUERY_NAME) {
             if(recurse || type!=TYPE_ALL)_fillQueryNamesRec("",query, directory, filter, 0,recurse);
             else _fillQueryNames(query, directory, nameFilter, 0);
      }
     
      //Array Name/Path
      else if(listInfo==LIST_INFO_ARRAY_NAME || listInfo==LIST_INFO_ARRAY_PATH) {
        boolean onlyName=listInfo==LIST_INFO_ARRAY_NAME;
             if(!onlyName || recurse || type!=TYPE_ALL)_fillArrayPathOrName(array, directory, nameFilter, 0, recurse, onlyName);//QueryNamesRec("",query, directory, filter, 0,recurse);
             else _fillArrayName(array, directory, nameFilter, 0);
     
      
            
        } catch (IOException e) {
            throw Caster.toPageException(e);
        }
   
    // sort
    if(sort!=null && query!=null) {
      String[] arr=sort.toLowerCase().split(",");
      for(int i=arr.length-1;i>=0;i--) {
        try {
          String[] col=arr[i].trim().split("\\s+");
          if(col.length==1)query.sort(col[0].trim());
          else if(col.length==2) {
            String order=col[1].toLowerCase().trim();
            if(order.equals("asc"))
              query.sort(col[0],railo.runtime.type.Query.ORDER_ASC);
            else if(order.equals("desc"))
              query.sort(col[0],railo.runtime.type.Query.ORDER_DESC);
            else
              throw new ApplicationException("invalid order type ["+col[1]+"]");
          }
        }
        catch(Throwable t) {}
      }   
    }
View Full Code Here

    if(directory.exists()) {
      if(directory.isDirectory()) {
        if ( nameConflict == NAMECONFLICT_SKIP )
          return;

        throw new ApplicationException("directory ["+directory.toString()+"] already exist");
      }
      else if(directory.isFile())
        throw new ApplicationException("can't create directory ["+directory.toString()+"], it exist a file with same name");
    }
    //if(!directory.mkdirs())  throw new ApplicationException("can't create directory ["+directory.toString()+"]");
    try {
      directory.createDirectory(createPath);
    } catch (IOException ioe) {
View Full Code Here

      securityManager.checkFileLocation(pc.getConfig(),dir,serverPassword);
     
    // directory doesn't exist
    if(!dir.exists()) {
      if(dir.isDirectory())
        throw new ApplicationException("directory ["+dir.toString()+"] doesn't exist");
      else if(dir.isFile())
        throw new ApplicationException("file ["+dir.toString()+"] doesn't exist and isn't a directory");
    }
   
    // check if file
    if(dir.isFile())
      throw new ApplicationException("can't delete ["+dir.toString()+"], it isn't a directory it is a file");
   
    // delete directory
    try {
      dir.remove(forceDelete);
    } catch (IOException e) {
View Full Code Here

TOP

Related Classes of railo.runtime.exp.ApplicationException

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.