Package org.apache.ftpserver.ftplet

Examples of org.apache.ftpserver.ftplet.FtpException


            if(server == null) {
                // get configuration
                Configuration config = getConfiguration(args);
                if(config == null) {
                    LOG.error("No configuration provided");
                    throw new FtpException("No configuration provided");
                }
   
                // create root configuration object
                FtpServerContext serverContext = new ConfigurableFtpServerContext(config);
   
View Full Code Here


            else if( (args.length == 3) && args[1].equals("-prop") ) {
                LOG.info("Using properties configuration file " + args[2] + "...");
                in = new FileInputStream(args[2]);
                config = new PropertiesConfiguration(in);
            } else {
                throw new FtpException("Invalid configuration option");
            }
        }
        finally {
            IoUtils.close(in);
        }
View Full Code Here

                pair.defaultProperties.load(in);
            }
        }
        catch(Exception ex) {
            LOG.warn("MessageResourceImpl.createPropertiesPair()", ex);
            throw new FtpException("MessageResourceImpl.createPropertiesPair()", ex);
        }
        finally {
            IoUtils.close(in);
        }
       
        // load custom resource
        File resourceFile = null;
        if(lang == null) {
            resourceFile = new File(customMessageDirectory, "FtpStatus.gen");
        }
        else {
            resourceFile = new File(customMessageDirectory, "FtpStatus_" + lang + ".gen");
        }
        in = null;
        try {
            if(resourceFile.exists()) {
                in = new FileInputStream(resourceFile);
                pair.customProperties.load(in);
            }
        }
        catch(Exception ex) {
            LOG.warn("MessageResourceImpl.createPropertiesPair()", ex);
            throw new FtpException("MessageResourceImpl.createPropertiesPair()", ex);
        }
        finally {
            IoUtils.close(in);
        }
       
View Full Code Here

            out = new FileOutputStream(resourceFile);
            prop.store(out, "Custom Messages");
        }
        catch(IOException ex) {
            LOG.error("MessageResourceImpl.save()", ex);
            throw new FtpException("MessageResourceImpl.save()", ex);
        }
        finally {
            IoUtils.close(out);
        }
       
View Full Code Here

     * Get string - if not found throws FtpException.
     */
    public String getString(String param) throws FtpException {
        String val = prop.getProperty(prefix + param);
        if(val == null) {
            throw new FtpException("Not found : " + param);
        }
        return val;
    }
View Full Code Here

     * Get integer - if not found throws FtpException.
     */
    public int getInt(String param) throws FtpException {
        String val = prop.getProperty(prefix + param);
        if(val == null) {
            throw new FtpException("Not found : " + param);
        }
       
        try {
            return Integer.parseInt(val);
        }
        catch(Exception ex) {
            throw new FtpException("PropertiesConfiguration.getInt()", ex);
        }
    }
View Full Code Here

     * Get long - if not found throws FtpException.
     */
    public long getLong(String param) throws FtpException {
        String val = prop.getProperty(prefix + param);
        if(val == null) {
            throw new FtpException("Not found : " + param);
        }
       
        try {
            return Long.parseLong(val);
        }
        catch(Exception ex) {
            throw new FtpException("PropertiesConfiguration.getLong()", ex);
        }
    }
View Full Code Here

     * Get boolean - if not found throws FtpException.
     */
    public boolean getBoolean(String param) throws FtpException {
        String val = prop.getProperty(prefix + param);
        if(val == null) {
            throw new FtpException("Not found : " + param);
        }
        return val.equalsIgnoreCase("true");
    }
View Full Code Here

     * Get double - if not found throws FtpException.
     */
    public double getDouble(String param) throws FtpException {
        String val = prop.getProperty(prefix + param);
        if(val == null) {
            throw new FtpException("Not found : " + param);
        }
       
        try {
            return Double.parseDouble(val);
        }
        catch(Exception ex) {
            throw new FtpException("PropertiesConfiguration.getDouble()", ex);
        }
    }
View Full Code Here

    public String getString(String param) throws FtpException {
       
        // get child
        XmlConfiguration child = getChild(param);
        if(child == null) {
            throw new FtpException("Not found : " + param);
        }
       
        String val = child.value;
        if(val == null) {
            throw new FtpException("Not found : " + param);
        }
        return val;
    }
View Full Code Here

TOP

Related Classes of org.apache.ftpserver.ftplet.FtpException

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.