You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ng...@apache.org on 2013/08/12 00:16:19 UTC

[24/50] [abbrv] git commit: Fix eol-style

Fix eol-style

git-svn-id: https://svn.apache.org/repos/asf/mina/ftpserver/trunk@1129827 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/mina-ftpserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-ftpserver/commit/9769d29a
Tree: http://git-wip-us.apache.org/repos/asf/mina-ftpserver/tree/9769d29a
Diff: http://git-wip-us.apache.org/repos/asf/mina-ftpserver/diff/9769d29a

Branch: refs/heads/trunk
Commit: 9769d29a75eb50a8368e8b0cdbe2f29fa852409e
Parents: bda3f6b
Author: Sebastian Bazley <se...@apache.org>
Authored: Tue May 31 17:52:32 2011 +0000
Committer: Sebastian Bazley <se...@apache.org>
Committed: Tue May 31 17:52:32 2011 +0000

----------------------------------------------------------------------
 .../spring/ListenerBeanDefinitionParser.java    | 600 +++++++++----------
 .../impl/LocalizedDataTransferFtpReply.java     | 268 ++++-----
 .../impl/LocalizedFileActionFtpReply.java       | 176 +++---
 .../ftpserver/impl/LocalizedRenameFtpReply.java | 206 +++----
 .../ftpserver/ipfilter/MinaSessionFilter.java   | 116 ++--
 .../ftpserver/ipfilter/RemoteIpFilter.java      | 446 +++++++-------
 .../clienttests/ActiveModeReplyTest.java        | 158 ++---
 .../PasvAddressWithOverridenHostnameGetter.java | 146 ++---
 .../impl/listing/DirectoryListerTest.java       | 206 +++----
 .../ftpserver/ssl/MinaCipherSuitesTest.java     | 174 +++---
 10 files changed, 1248 insertions(+), 1248 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-ftpserver/blob/9769d29a/core/src/main/java/org/apache/ftpserver/config/spring/ListenerBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/ftpserver/config/spring/ListenerBeanDefinitionParser.java b/core/src/main/java/org/apache/ftpserver/config/spring/ListenerBeanDefinitionParser.java
index c367669..68cf398 100644
--- a/core/src/main/java/org/apache/ftpserver/config/spring/ListenerBeanDefinitionParser.java
+++ b/core/src/main/java/org/apache/ftpserver/config/spring/ListenerBeanDefinitionParser.java
@@ -1,300 +1,300 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ftpserver.config.spring;
-
-import java.net.UnknownHostException;
-
-import org.apache.ftpserver.DataConnectionConfiguration;
-import org.apache.ftpserver.DataConnectionConfigurationFactory;
-import org.apache.ftpserver.FtpServerConfigurationException;
-import org.apache.ftpserver.ipfilter.IpFilterType;
-import org.apache.ftpserver.ipfilter.RemoteIpFilter;
-import org.apache.ftpserver.listener.ListenerFactory;
-import org.apache.ftpserver.ssl.SslConfiguration;
-import org.apache.ftpserver.ssl.SslConfigurationFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.util.StringUtils;
-import org.w3c.dom.Element;
-
-/**
- * Parses the FtpServer "nio-listener" element into a Spring bean graph
- *
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ListenerBeanDefinitionParser extends
-        AbstractSingleBeanDefinitionParser {
-
-    private final Logger LOG = LoggerFactory
-            .getLogger(ListenerBeanDefinitionParser.class);
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected Class<?> getBeanClass(final Element element) {
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void doParse(final Element element,
-            final ParserContext parserContext,
-            final BeanDefinitionBuilder builder) {
-
-        BeanDefinitionBuilder factoryBuilder = BeanDefinitionBuilder.genericBeanDefinition(ListenerFactory.class);
-
-        if (StringUtils.hasText(element.getAttribute("port"))) {
-            factoryBuilder.addPropertyValue("port", Integer.valueOf(element
-                    .getAttribute("port")));
-        }
-
-        SslConfiguration ssl = parseSsl(element);
-        if (ssl != null) {
-            factoryBuilder.addPropertyValue("sslConfiguration", ssl);
-        }
-
-        Element dataConElm = SpringUtil.getChildElement(element,
-                FtpServerNamespaceHandler.FTPSERVER_NS, "data-connection");
-        DataConnectionConfiguration dc = parseDataConnection(dataConElm, ssl);
-        factoryBuilder.addPropertyValue("dataConnectionConfiguration", dc);
-
-        if (StringUtils.hasText(element.getAttribute("idle-timeout"))) {
-            factoryBuilder.addPropertyValue("idleTimeout", SpringUtil.parseInt(
-                    element, "idle-timeout", 300));
-        }
-
-        String localAddress = SpringUtil.parseStringFromInetAddress(element,
-                "local-address");
-        if (localAddress != null) {
-            factoryBuilder.addPropertyValue("serverAddress", localAddress);
-        }
-        factoryBuilder.addPropertyValue("implicitSsl", SpringUtil.parseBoolean(
-                element, "implicit-ssl", false));
-
-        Element blacklistElm = SpringUtil.getChildElement(element,
-                FtpServerNamespaceHandler.FTPSERVER_NS, "blacklist");
-        if (blacklistElm != null) {
-            LOG
-                    .warn("Element 'blacklist' is deprecated, and may be removed in a future release. Please use 'remote-ip-filter' instead. ");
-            try {
-                RemoteIpFilter remoteIpFilter = new RemoteIpFilter(IpFilterType.DENY,
-                        blacklistElm.getTextContent());
-                factoryBuilder.addPropertyValue("sessionFilter", remoteIpFilter);
-            } catch (UnknownHostException e) {
-                throw new IllegalArgumentException(
-                        "Invalid IP address or subnet in the 'blacklist' element",
-                        e);
-            }
-        }
-
-        Element remoteIpFilterElement = SpringUtil.getChildElement(element,
-                FtpServerNamespaceHandler.FTPSERVER_NS, "remote-ip-filter");
-        if (remoteIpFilterElement != null) {
-            if (blacklistElm != null) {
-                throw new FtpServerConfigurationException(
-                        "Element 'remote-ip-filter' may not be used when 'blacklist' element is specified. ");
-            }
-            String filterType = remoteIpFilterElement.getAttribute("type");
-            try {
-                RemoteIpFilter remoteIpFilter = new RemoteIpFilter(IpFilterType
-                        .parse(filterType), remoteIpFilterElement
-                        .getTextContent());
-                factoryBuilder
-                        .addPropertyValue("sessionFilter", remoteIpFilter);
-            } catch (UnknownHostException e) {
-                throw new IllegalArgumentException(
-                        "Invalid IP address or subnet in the 'remote-ip-filter' element");
-            }
-        }
-        
-        BeanDefinition factoryDefinition = factoryBuilder.getBeanDefinition();
-
-        String listenerFactoryName = parserContext.getReaderContext().generateBeanName(factoryDefinition);
-        
-        BeanDefinitionHolder factoryHolder = new BeanDefinitionHolder(factoryDefinition, listenerFactoryName);
-        registerBeanDefinition(factoryHolder, parserContext.getRegistry());
-
-        // set the factory on the listener bean
-        builder.getRawBeanDefinition().setFactoryBeanName(listenerFactoryName);
-        builder.getRawBeanDefinition().setFactoryMethodName("createListener");
-    }
-
-    private SslConfiguration parseSsl(final Element parent) {
-        Element sslElm = SpringUtil.getChildElement(parent,
-                FtpServerNamespaceHandler.FTPSERVER_NS, "ssl");
-
-        if (sslElm != null) {
-            SslConfigurationFactory ssl = new SslConfigurationFactory();
-
-            Element keyStoreElm = SpringUtil.getChildElement(sslElm,
-                    FtpServerNamespaceHandler.FTPSERVER_NS, "keystore");
-            if (keyStoreElm != null) {
-                ssl.setKeystoreFile(SpringUtil.parseFile(keyStoreElm, "file"));
-                ssl.setKeystorePassword(SpringUtil.parseString(keyStoreElm,
-                        "password"));
-
-                String type = SpringUtil.parseString(keyStoreElm, "type");
-                if (type != null) {
-                    ssl.setKeystoreType(type);
-                }
-
-                String keyAlias = SpringUtil.parseString(keyStoreElm,
-                        "key-alias");
-                if (keyAlias != null) {
-                    ssl.setKeyAlias(keyAlias);
-                }
-
-                String keyPassword = SpringUtil.parseString(keyStoreElm,
-                        "key-password");
-                if (keyPassword != null) {
-                    ssl.setKeyPassword(keyPassword);
-                }
-
-                String algorithm = SpringUtil.parseString(keyStoreElm,
-                        "algorithm");
-                if (algorithm != null) {
-                    ssl.setKeystoreAlgorithm(algorithm);
-                }
-            }
-
-            Element trustStoreElm = SpringUtil.getChildElement(sslElm,
-                    FtpServerNamespaceHandler.FTPSERVER_NS, "truststore");
-            if (trustStoreElm != null) {
-                ssl.setTruststoreFile(SpringUtil.parseFile(trustStoreElm,
-                        "file"));
-                ssl.setTruststorePassword(SpringUtil.parseString(trustStoreElm,
-                        "password"));
-
-                String type = SpringUtil.parseString(trustStoreElm, "type");
-                if (type != null) {
-                    ssl.setTruststoreType(type);
-                }
-
-                String algorithm = SpringUtil.parseString(trustStoreElm,
-                        "algorithm");
-                if (algorithm != null) {
-                    ssl.setTruststoreAlgorithm(algorithm);
-                }
-            }
-
-            String clientAuthStr = SpringUtil.parseString(sslElm,
-                    "client-authentication");
-            if (clientAuthStr != null) {
-                ssl.setClientAuthentication(clientAuthStr);
-            }
-
-            String enabledCiphersuites = SpringUtil.parseString(sslElm,
-                    "enabled-ciphersuites");
-            if (enabledCiphersuites != null) {
-                ssl.setEnabledCipherSuites(enabledCiphersuites.split(" "));
-            }
-
-            String protocol = SpringUtil.parseString(sslElm, "protocol");
-            if (protocol != null) {
-                ssl.setSslProtocol(protocol);
-            }
-
-            return ssl.createSslConfiguration();
-        } else {
-            return null;
-        }
-
-    }
-
-    private DataConnectionConfiguration parseDataConnection(
-            final Element element,
-            final SslConfiguration listenerSslConfiguration) {
-        DataConnectionConfigurationFactory dc = new DataConnectionConfigurationFactory();
-
-        if (element != null) {
-            
-            dc.setImplicitSsl(SpringUtil.parseBoolean(element, "implicit-ssl", false));
-            
-            // data con config element available
-            SslConfiguration ssl = parseSsl(element);
-
-            if (ssl != null) {
-                LOG.debug("SSL configuration found for the data connection");
-                dc.setSslConfiguration(ssl);
-            }
-
-            dc.setIdleTime(SpringUtil.parseInt(element, "idle-timeout", dc.getIdleTime()));
-
-            Element activeElm = SpringUtil.getChildElement(element,
-                    FtpServerNamespaceHandler.FTPSERVER_NS, "active");
-            if (activeElm != null) {
-                dc.setActiveEnabled(SpringUtil.parseBoolean(activeElm, "enabled",
-                        true));
-                dc.setActiveIpCheck(SpringUtil.parseBoolean(activeElm,
-                        "ip-check", false));
-                dc.setActiveLocalPort(SpringUtil.parseInt(activeElm,
-                        "local-port", 0));
-                
-                String localAddress = SpringUtil.parseStringFromInetAddress(
-                        activeElm, "local-address");
-                if (localAddress != null) {
-                	dc.setActiveLocalAddress(localAddress);
-                }
-            }
-
-            Element passiveElm = SpringUtil.getChildElement(element,
-                    FtpServerNamespaceHandler.FTPSERVER_NS, "passive");
-            if (passiveElm != null) {
-                String address = SpringUtil.parseStringFromInetAddress(passiveElm,
-                        "address");
-                if (address != null) {
-                	dc.setPassiveAddress(address);
-                }
-
-                String externalAddress = SpringUtil.parseStringFromInetAddress(
-                        passiveElm, "external-address");
-                if (externalAddress != null) {
-                    dc.setPassiveExternalAddress(externalAddress);
-                }
-
-                String ports = SpringUtil.parseString(passiveElm, "ports");
-                if (ports != null) {
-                    dc.setPassivePorts(ports);
-                }
-                dc.setPassiveIpCheck(SpringUtil.parseBoolean(passiveElm,
-                    "ip-check", false));
-            }
-        } else {
-            // no data conn config element, do we still have SSL config from the
-            // parent?
-            if (listenerSslConfiguration != null) {
-                LOG
-                        .debug("SSL configuration found for the listener, falling back for that for the data connection");
-                dc.setSslConfiguration(listenerSslConfiguration);
-            }
-        }
-
-        return dc.createDataConnectionConfiguration();
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ftpserver.config.spring;
+
+import java.net.UnknownHostException;
+
+import org.apache.ftpserver.DataConnectionConfiguration;
+import org.apache.ftpserver.DataConnectionConfigurationFactory;
+import org.apache.ftpserver.FtpServerConfigurationException;
+import org.apache.ftpserver.ipfilter.IpFilterType;
+import org.apache.ftpserver.ipfilter.RemoteIpFilter;
+import org.apache.ftpserver.listener.ListenerFactory;
+import org.apache.ftpserver.ssl.SslConfiguration;
+import org.apache.ftpserver.ssl.SslConfigurationFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanDefinitionHolder;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.util.StringUtils;
+import org.w3c.dom.Element;
+
+/**
+ * Parses the FtpServer "nio-listener" element into a Spring bean graph
+ *
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ListenerBeanDefinitionParser extends
+        AbstractSingleBeanDefinitionParser {
+
+    private final Logger LOG = LoggerFactory
+            .getLogger(ListenerBeanDefinitionParser.class);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Class<?> getBeanClass(final Element element) {
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void doParse(final Element element,
+            final ParserContext parserContext,
+            final BeanDefinitionBuilder builder) {
+
+        BeanDefinitionBuilder factoryBuilder = BeanDefinitionBuilder.genericBeanDefinition(ListenerFactory.class);
+
+        if (StringUtils.hasText(element.getAttribute("port"))) {
+            factoryBuilder.addPropertyValue("port", Integer.valueOf(element
+                    .getAttribute("port")));
+        }
+
+        SslConfiguration ssl = parseSsl(element);
+        if (ssl != null) {
+            factoryBuilder.addPropertyValue("sslConfiguration", ssl);
+        }
+
+        Element dataConElm = SpringUtil.getChildElement(element,
+                FtpServerNamespaceHandler.FTPSERVER_NS, "data-connection");
+        DataConnectionConfiguration dc = parseDataConnection(dataConElm, ssl);
+        factoryBuilder.addPropertyValue("dataConnectionConfiguration", dc);
+
+        if (StringUtils.hasText(element.getAttribute("idle-timeout"))) {
+            factoryBuilder.addPropertyValue("idleTimeout", SpringUtil.parseInt(
+                    element, "idle-timeout", 300));
+        }
+
+        String localAddress = SpringUtil.parseStringFromInetAddress(element,
+                "local-address");
+        if (localAddress != null) {
+            factoryBuilder.addPropertyValue("serverAddress", localAddress);
+        }
+        factoryBuilder.addPropertyValue("implicitSsl", SpringUtil.parseBoolean(
+                element, "implicit-ssl", false));
+
+        Element blacklistElm = SpringUtil.getChildElement(element,
+                FtpServerNamespaceHandler.FTPSERVER_NS, "blacklist");
+        if (blacklistElm != null) {
+            LOG
+                    .warn("Element 'blacklist' is deprecated, and may be removed in a future release. Please use 'remote-ip-filter' instead. ");
+            try {
+                RemoteIpFilter remoteIpFilter = new RemoteIpFilter(IpFilterType.DENY,
+                        blacklistElm.getTextContent());
+                factoryBuilder.addPropertyValue("sessionFilter", remoteIpFilter);
+            } catch (UnknownHostException e) {
+                throw new IllegalArgumentException(
+                        "Invalid IP address or subnet in the 'blacklist' element",
+                        e);
+            }
+        }
+
+        Element remoteIpFilterElement = SpringUtil.getChildElement(element,
+                FtpServerNamespaceHandler.FTPSERVER_NS, "remote-ip-filter");
+        if (remoteIpFilterElement != null) {
+            if (blacklistElm != null) {
+                throw new FtpServerConfigurationException(
+                        "Element 'remote-ip-filter' may not be used when 'blacklist' element is specified. ");
+            }
+            String filterType = remoteIpFilterElement.getAttribute("type");
+            try {
+                RemoteIpFilter remoteIpFilter = new RemoteIpFilter(IpFilterType
+                        .parse(filterType), remoteIpFilterElement
+                        .getTextContent());
+                factoryBuilder
+                        .addPropertyValue("sessionFilter", remoteIpFilter);
+            } catch (UnknownHostException e) {
+                throw new IllegalArgumentException(
+                        "Invalid IP address or subnet in the 'remote-ip-filter' element");
+            }
+        }
+        
+        BeanDefinition factoryDefinition = factoryBuilder.getBeanDefinition();
+
+        String listenerFactoryName = parserContext.getReaderContext().generateBeanName(factoryDefinition);
+        
+        BeanDefinitionHolder factoryHolder = new BeanDefinitionHolder(factoryDefinition, listenerFactoryName);
+        registerBeanDefinition(factoryHolder, parserContext.getRegistry());
+
+        // set the factory on the listener bean
+        builder.getRawBeanDefinition().setFactoryBeanName(listenerFactoryName);
+        builder.getRawBeanDefinition().setFactoryMethodName("createListener");
+    }
+
+    private SslConfiguration parseSsl(final Element parent) {
+        Element sslElm = SpringUtil.getChildElement(parent,
+                FtpServerNamespaceHandler.FTPSERVER_NS, "ssl");
+
+        if (sslElm != null) {
+            SslConfigurationFactory ssl = new SslConfigurationFactory();
+
+            Element keyStoreElm = SpringUtil.getChildElement(sslElm,
+                    FtpServerNamespaceHandler.FTPSERVER_NS, "keystore");
+            if (keyStoreElm != null) {
+                ssl.setKeystoreFile(SpringUtil.parseFile(keyStoreElm, "file"));
+                ssl.setKeystorePassword(SpringUtil.parseString(keyStoreElm,
+                        "password"));
+
+                String type = SpringUtil.parseString(keyStoreElm, "type");
+                if (type != null) {
+                    ssl.setKeystoreType(type);
+                }
+
+                String keyAlias = SpringUtil.parseString(keyStoreElm,
+                        "key-alias");
+                if (keyAlias != null) {
+                    ssl.setKeyAlias(keyAlias);
+                }
+
+                String keyPassword = SpringUtil.parseString(keyStoreElm,
+                        "key-password");
+                if (keyPassword != null) {
+                    ssl.setKeyPassword(keyPassword);
+                }
+
+                String algorithm = SpringUtil.parseString(keyStoreElm,
+                        "algorithm");
+                if (algorithm != null) {
+                    ssl.setKeystoreAlgorithm(algorithm);
+                }
+            }
+
+            Element trustStoreElm = SpringUtil.getChildElement(sslElm,
+                    FtpServerNamespaceHandler.FTPSERVER_NS, "truststore");
+            if (trustStoreElm != null) {
+                ssl.setTruststoreFile(SpringUtil.parseFile(trustStoreElm,
+                        "file"));
+                ssl.setTruststorePassword(SpringUtil.parseString(trustStoreElm,
+                        "password"));
+
+                String type = SpringUtil.parseString(trustStoreElm, "type");
+                if (type != null) {
+                    ssl.setTruststoreType(type);
+                }
+
+                String algorithm = SpringUtil.parseString(trustStoreElm,
+                        "algorithm");
+                if (algorithm != null) {
+                    ssl.setTruststoreAlgorithm(algorithm);
+                }
+            }
+
+            String clientAuthStr = SpringUtil.parseString(sslElm,
+                    "client-authentication");
+            if (clientAuthStr != null) {
+                ssl.setClientAuthentication(clientAuthStr);
+            }
+
+            String enabledCiphersuites = SpringUtil.parseString(sslElm,
+                    "enabled-ciphersuites");
+            if (enabledCiphersuites != null) {
+                ssl.setEnabledCipherSuites(enabledCiphersuites.split(" "));
+            }
+
+            String protocol = SpringUtil.parseString(sslElm, "protocol");
+            if (protocol != null) {
+                ssl.setSslProtocol(protocol);
+            }
+
+            return ssl.createSslConfiguration();
+        } else {
+            return null;
+        }
+
+    }
+
+    private DataConnectionConfiguration parseDataConnection(
+            final Element element,
+            final SslConfiguration listenerSslConfiguration) {
+        DataConnectionConfigurationFactory dc = new DataConnectionConfigurationFactory();
+
+        if (element != null) {
+            
+            dc.setImplicitSsl(SpringUtil.parseBoolean(element, "implicit-ssl", false));
+            
+            // data con config element available
+            SslConfiguration ssl = parseSsl(element);
+
+            if (ssl != null) {
+                LOG.debug("SSL configuration found for the data connection");
+                dc.setSslConfiguration(ssl);
+            }
+
+            dc.setIdleTime(SpringUtil.parseInt(element, "idle-timeout", dc.getIdleTime()));
+
+            Element activeElm = SpringUtil.getChildElement(element,
+                    FtpServerNamespaceHandler.FTPSERVER_NS, "active");
+            if (activeElm != null) {
+                dc.setActiveEnabled(SpringUtil.parseBoolean(activeElm, "enabled",
+                        true));
+                dc.setActiveIpCheck(SpringUtil.parseBoolean(activeElm,
+                        "ip-check", false));
+                dc.setActiveLocalPort(SpringUtil.parseInt(activeElm,
+                        "local-port", 0));
+                
+                String localAddress = SpringUtil.parseStringFromInetAddress(
+                        activeElm, "local-address");
+                if (localAddress != null) {
+                	dc.setActiveLocalAddress(localAddress);
+                }
+            }
+
+            Element passiveElm = SpringUtil.getChildElement(element,
+                    FtpServerNamespaceHandler.FTPSERVER_NS, "passive");
+            if (passiveElm != null) {
+                String address = SpringUtil.parseStringFromInetAddress(passiveElm,
+                        "address");
+                if (address != null) {
+                	dc.setPassiveAddress(address);
+                }
+
+                String externalAddress = SpringUtil.parseStringFromInetAddress(
+                        passiveElm, "external-address");
+                if (externalAddress != null) {
+                    dc.setPassiveExternalAddress(externalAddress);
+                }
+
+                String ports = SpringUtil.parseString(passiveElm, "ports");
+                if (ports != null) {
+                    dc.setPassivePorts(ports);
+                }
+                dc.setPassiveIpCheck(SpringUtil.parseBoolean(passiveElm,
+                    "ip-check", false));
+            }
+        } else {
+            // no data conn config element, do we still have SSL config from the
+            // parent?
+            if (listenerSslConfiguration != null) {
+                LOG
+                        .debug("SSL configuration found for the listener, falling back for that for the data connection");
+                dc.setSslConfiguration(listenerSslConfiguration);
+            }
+        }
+
+        return dc.createDataConnectionConfiguration();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/mina-ftpserver/blob/9769d29a/core/src/main/java/org/apache/ftpserver/impl/LocalizedDataTransferFtpReply.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/ftpserver/impl/LocalizedDataTransferFtpReply.java b/core/src/main/java/org/apache/ftpserver/impl/LocalizedDataTransferFtpReply.java
index efdcacd..12f367e 100644
--- a/core/src/main/java/org/apache/ftpserver/impl/LocalizedDataTransferFtpReply.java
+++ b/core/src/main/java/org/apache/ftpserver/impl/LocalizedDataTransferFtpReply.java
@@ -1,134 +1,134 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ftpserver.impl;
-
-import org.apache.ftpserver.ftplet.DataTransferFtpReply;
-import org.apache.ftpserver.ftplet.FtpFile;
-import org.apache.ftpserver.ftplet.FtpRequest;
-
-/**
- * An implementation of <code>DataTransferReply</code>.
- * 
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- * 
- */
-
-public class LocalizedDataTransferFtpReply extends LocalizedFtpReply implements
-	DataTransferFtpReply {
-
-	/**
-	 * The file or directory that data transfer is related to.
-	 */
-	private final FtpFile file;
-
-	/**
-	 * total number of bytes transferred (bytes sent to the client or receivved
-	 * from the client)
-	 */
-	private final long bytesTransferred;
-
-	/**
-	 * Creates a new instance of <code>LocalizedFileTransferReply</code>.
-	 * 
-	 * @param code
-	 *            the reply code
-	 * @param message
-	 *            the detailed message
-	 * @param file
-	 *            the file or directory the data transfer is related to
-	 * @param bytesTransferred
-	 *            the number of bytes transferred
-	 */
-	public LocalizedDataTransferFtpReply(int code, String message,
-		FtpFile file, long bytesTransferred) {
-		super(code, message);
-		this.file = file;
-		this.bytesTransferred = bytesTransferred;
-	}
-
-	public FtpFile getFile() {
-		return file;
-	}
-
-	public long getBytesTransferred() {
-		return bytesTransferred;
-	}
-
-	/**
-	 * Returns the localized reply that contains all details about the data
-	 * transfer.
-	 * 
-	 * @param session
-	 *            the FTP session
-	 * @param request
-	 *            the FTP request
-	 * @param context
-	 *            the FTP server context
-	 * @param code
-	 *            the reply code
-	 * @param subId
-	 *            the sub message ID
-	 * @param basicMsg
-	 *            the basic message
-	 * @param file
-	 *            the file or directory that was transferred
-	 * @return the localized reply
-	 */
-	public static LocalizedDataTransferFtpReply translate(FtpIoSession session,
-		FtpRequest request, FtpServerContext context, int code, String subId,
-		String basicMsg, FtpFile file) {
-		String msg = FtpReplyTranslator.translateMessage(session, request,
-			context, code, subId, basicMsg);
-
-		return new LocalizedDataTransferFtpReply(code, msg, file, 0);
-	}
-
-	/**
-	 * Returns the localized reply that contains all details about the data
-	 * transfer.
-	 * 
-	 * @param session
-	 *            the FTP session
-	 * @param request
-	 *            the FTP request
-	 * @param context
-	 *            the FTP server context
-	 * @param code
-	 *            the reply code
-	 * @param subId
-	 *            the sub message ID
-	 * @param basicMsg
-	 *            the basic message
-	 * @param file
-	 *            the file or directory that was transferred
-	 * @param bytesTransferred
-	 *            total number of bytes transferred
-	 * @return the localized reply
-	 */
-	public static LocalizedDataTransferFtpReply translate(FtpIoSession session,
-		FtpRequest request, FtpServerContext context, int code, String subId,
-		String basicMsg, FtpFile file, long bytesTransferred) {
-		String msg = FtpReplyTranslator.translateMessage(session, request,
-			context, code, subId, basicMsg);
-
-		return new LocalizedDataTransferFtpReply(code, msg, file,
-			bytesTransferred);
-	}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ftpserver.impl;
+
+import org.apache.ftpserver.ftplet.DataTransferFtpReply;
+import org.apache.ftpserver.ftplet.FtpFile;
+import org.apache.ftpserver.ftplet.FtpRequest;
+
+/**
+ * An implementation of <code>DataTransferReply</code>.
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ * 
+ */
+
+public class LocalizedDataTransferFtpReply extends LocalizedFtpReply implements
+	DataTransferFtpReply {
+
+	/**
+	 * The file or directory that data transfer is related to.
+	 */
+	private final FtpFile file;
+
+	/**
+	 * total number of bytes transferred (bytes sent to the client or receivved
+	 * from the client)
+	 */
+	private final long bytesTransferred;
+
+	/**
+	 * Creates a new instance of <code>LocalizedFileTransferReply</code>.
+	 * 
+	 * @param code
+	 *            the reply code
+	 * @param message
+	 *            the detailed message
+	 * @param file
+	 *            the file or directory the data transfer is related to
+	 * @param bytesTransferred
+	 *            the number of bytes transferred
+	 */
+	public LocalizedDataTransferFtpReply(int code, String message,
+		FtpFile file, long bytesTransferred) {
+		super(code, message);
+		this.file = file;
+		this.bytesTransferred = bytesTransferred;
+	}
+
+	public FtpFile getFile() {
+		return file;
+	}
+
+	public long getBytesTransferred() {
+		return bytesTransferred;
+	}
+
+	/**
+	 * Returns the localized reply that contains all details about the data
+	 * transfer.
+	 * 
+	 * @param session
+	 *            the FTP session
+	 * @param request
+	 *            the FTP request
+	 * @param context
+	 *            the FTP server context
+	 * @param code
+	 *            the reply code
+	 * @param subId
+	 *            the sub message ID
+	 * @param basicMsg
+	 *            the basic message
+	 * @param file
+	 *            the file or directory that was transferred
+	 * @return the localized reply
+	 */
+	public static LocalizedDataTransferFtpReply translate(FtpIoSession session,
+		FtpRequest request, FtpServerContext context, int code, String subId,
+		String basicMsg, FtpFile file) {
+		String msg = FtpReplyTranslator.translateMessage(session, request,
+			context, code, subId, basicMsg);
+
+		return new LocalizedDataTransferFtpReply(code, msg, file, 0);
+	}
+
+	/**
+	 * Returns the localized reply that contains all details about the data
+	 * transfer.
+	 * 
+	 * @param session
+	 *            the FTP session
+	 * @param request
+	 *            the FTP request
+	 * @param context
+	 *            the FTP server context
+	 * @param code
+	 *            the reply code
+	 * @param subId
+	 *            the sub message ID
+	 * @param basicMsg
+	 *            the basic message
+	 * @param file
+	 *            the file or directory that was transferred
+	 * @param bytesTransferred
+	 *            total number of bytes transferred
+	 * @return the localized reply
+	 */
+	public static LocalizedDataTransferFtpReply translate(FtpIoSession session,
+		FtpRequest request, FtpServerContext context, int code, String subId,
+		String basicMsg, FtpFile file, long bytesTransferred) {
+		String msg = FtpReplyTranslator.translateMessage(session, request,
+			context, code, subId, basicMsg);
+
+		return new LocalizedDataTransferFtpReply(code, msg, file,
+			bytesTransferred);
+	}
+}

http://git-wip-us.apache.org/repos/asf/mina-ftpserver/blob/9769d29a/core/src/main/java/org/apache/ftpserver/impl/LocalizedFileActionFtpReply.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/ftpserver/impl/LocalizedFileActionFtpReply.java b/core/src/main/java/org/apache/ftpserver/impl/LocalizedFileActionFtpReply.java
index 84a18a4..a867c70 100644
--- a/core/src/main/java/org/apache/ftpserver/impl/LocalizedFileActionFtpReply.java
+++ b/core/src/main/java/org/apache/ftpserver/impl/LocalizedFileActionFtpReply.java
@@ -1,88 +1,88 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ftpserver.impl;
-
-import org.apache.ftpserver.ftplet.FileActionFtpReply;
-import org.apache.ftpserver.ftplet.FtpFile;
-import org.apache.ftpserver.ftplet.FtpRequest;
-
-/**
- * An implementation of <code>FileActionFtpReply</code>.
- * 
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- * 
- */
-
-public class LocalizedFileActionFtpReply extends LocalizedFtpReply implements
-	FileActionFtpReply {
-
-	/**
-	 * The file or directory that data transfer is related to.
-	 */
-	private final FtpFile file;
-
-	/**
-	 * Creates a new instance of <code>LocalizedFileTransferReply</code>.
-	 * 
-	 * @param code
-	 *            the reply code
-	 * @param message
-	 *            the detailed message
-	 * @param file
-	 *            the file or directory the data transfer is related to
-	 */
-	public LocalizedFileActionFtpReply(int code, String message, FtpFile file) {
-		super(code, message);
-		this.file = file;
-	}
-
-	public FtpFile getFile() {
-		return file;
-	}
-
-	/**
-	 * Returns the localized reply that contains all details about the data
-	 * transfer.
-	 * 
-	 * @param session
-	 *            the FTP session
-	 * @param request
-	 *            the FTP request
-	 * @param context
-	 *            the FTP server context
-	 * @param code
-	 *            the reply code
-	 * @param subId
-	 *            the sub message ID
-	 * @param basicMsg
-	 *            the basic message
-	 * @param file
-	 *            the file or directory that was transferred
-	 * @return the localized reply
-	 */
-	public static LocalizedFileActionFtpReply translate(FtpIoSession session,
-		FtpRequest request, FtpServerContext context, int code, String subId,
-		String basicMsg, FtpFile file) {
-		String msg = FtpReplyTranslator.translateMessage(session, request,
-			context, code, subId, basicMsg);
-
-		return new LocalizedFileActionFtpReply(code, msg, file);
-	}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ftpserver.impl;
+
+import org.apache.ftpserver.ftplet.FileActionFtpReply;
+import org.apache.ftpserver.ftplet.FtpFile;
+import org.apache.ftpserver.ftplet.FtpRequest;
+
+/**
+ * An implementation of <code>FileActionFtpReply</code>.
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ * 
+ */
+
+public class LocalizedFileActionFtpReply extends LocalizedFtpReply implements
+	FileActionFtpReply {
+
+	/**
+	 * The file or directory that data transfer is related to.
+	 */
+	private final FtpFile file;
+
+	/**
+	 * Creates a new instance of <code>LocalizedFileTransferReply</code>.
+	 * 
+	 * @param code
+	 *            the reply code
+	 * @param message
+	 *            the detailed message
+	 * @param file
+	 *            the file or directory the data transfer is related to
+	 */
+	public LocalizedFileActionFtpReply(int code, String message, FtpFile file) {
+		super(code, message);
+		this.file = file;
+	}
+
+	public FtpFile getFile() {
+		return file;
+	}
+
+	/**
+	 * Returns the localized reply that contains all details about the data
+	 * transfer.
+	 * 
+	 * @param session
+	 *            the FTP session
+	 * @param request
+	 *            the FTP request
+	 * @param context
+	 *            the FTP server context
+	 * @param code
+	 *            the reply code
+	 * @param subId
+	 *            the sub message ID
+	 * @param basicMsg
+	 *            the basic message
+	 * @param file
+	 *            the file or directory that was transferred
+	 * @return the localized reply
+	 */
+	public static LocalizedFileActionFtpReply translate(FtpIoSession session,
+		FtpRequest request, FtpServerContext context, int code, String subId,
+		String basicMsg, FtpFile file) {
+		String msg = FtpReplyTranslator.translateMessage(session, request,
+			context, code, subId, basicMsg);
+
+		return new LocalizedFileActionFtpReply(code, msg, file);
+	}
+}

http://git-wip-us.apache.org/repos/asf/mina-ftpserver/blob/9769d29a/core/src/main/java/org/apache/ftpserver/impl/LocalizedRenameFtpReply.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/ftpserver/impl/LocalizedRenameFtpReply.java b/core/src/main/java/org/apache/ftpserver/impl/LocalizedRenameFtpReply.java
index b67a83e..f822506 100644
--- a/core/src/main/java/org/apache/ftpserver/impl/LocalizedRenameFtpReply.java
+++ b/core/src/main/java/org/apache/ftpserver/impl/LocalizedRenameFtpReply.java
@@ -1,103 +1,103 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ftpserver.impl;
-
-import org.apache.ftpserver.ftplet.FtpFile;
-import org.apache.ftpserver.ftplet.FtpRequest;
-import org.apache.ftpserver.ftplet.RenameFtpReply;
-
-/**
- * An implementation of <code>RenameFtpReply</code> that is sent when a file
- * or directory is renamed.
- * 
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- * 
- */
-
-public class LocalizedRenameFtpReply extends LocalizedFtpReply implements
-	RenameFtpReply {
-
-	/**
-	 * The from file
-	 */
-	private final FtpFile from;
-
-	/**
-	 * The to file
-	 */
-	private final FtpFile to;
-
-	/**
-	 * Creates a new instance of <code>LocalizedRenameFtpReply</code>.
-	 * 
-	 * @param code
-	 *            the reply code
-	 * @param message
-	 *            the detailed message
-	 * @param from
-	 *            the old file
-	 * @param to
-	 *            the new file
-	 */
-	public LocalizedRenameFtpReply(int code, String message, FtpFile from,
-		FtpFile to) {
-		super(code, message);
-		this.from = from;
-		this.to = to;
-	}
-
-	public FtpFile getFrom() {
-		return from;
-	}
-
-	public FtpFile getTo() {
-		return to;
-	}
-
-	/**
-	 * Returns the localized reply that contains all details about the rename
-	 * operation.
-	 * 
-	 * @param session
-	 *            the FTP session
-	 * @param request
-	 *            the FTP request
-	 * @param context
-	 *            the FTP server context
-	 * @param code
-	 *            the reply code
-	 * @param subId
-	 *            the sub message ID
-	 * @param basicMsg
-	 *            the basic message
-	 * @param from
-	 *            the file or directory as it was before the rename
-	 * @param to
-	 *            the file or directory after the rename
-	 * @return the localized reply
-	 */
-	public static LocalizedRenameFtpReply translate(FtpIoSession session,
-		FtpRequest request, FtpServerContext context, int code, String subId,
-		String basicMsg, FtpFile from, FtpFile to) {
-		String msg = FtpReplyTranslator.translateMessage(session, request,
-			context, code, subId, basicMsg);
-		return new LocalizedRenameFtpReply(code, msg, from, to);
-	}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ftpserver.impl;
+
+import org.apache.ftpserver.ftplet.FtpFile;
+import org.apache.ftpserver.ftplet.FtpRequest;
+import org.apache.ftpserver.ftplet.RenameFtpReply;
+
+/**
+ * An implementation of <code>RenameFtpReply</code> that is sent when a file
+ * or directory is renamed.
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ * 
+ */
+
+public class LocalizedRenameFtpReply extends LocalizedFtpReply implements
+	RenameFtpReply {
+
+	/**
+	 * The from file
+	 */
+	private final FtpFile from;
+
+	/**
+	 * The to file
+	 */
+	private final FtpFile to;
+
+	/**
+	 * Creates a new instance of <code>LocalizedRenameFtpReply</code>.
+	 * 
+	 * @param code
+	 *            the reply code
+	 * @param message
+	 *            the detailed message
+	 * @param from
+	 *            the old file
+	 * @param to
+	 *            the new file
+	 */
+	public LocalizedRenameFtpReply(int code, String message, FtpFile from,
+		FtpFile to) {
+		super(code, message);
+		this.from = from;
+		this.to = to;
+	}
+
+	public FtpFile getFrom() {
+		return from;
+	}
+
+	public FtpFile getTo() {
+		return to;
+	}
+
+	/**
+	 * Returns the localized reply that contains all details about the rename
+	 * operation.
+	 * 
+	 * @param session
+	 *            the FTP session
+	 * @param request
+	 *            the FTP request
+	 * @param context
+	 *            the FTP server context
+	 * @param code
+	 *            the reply code
+	 * @param subId
+	 *            the sub message ID
+	 * @param basicMsg
+	 *            the basic message
+	 * @param from
+	 *            the file or directory as it was before the rename
+	 * @param to
+	 *            the file or directory after the rename
+	 * @return the localized reply
+	 */
+	public static LocalizedRenameFtpReply translate(FtpIoSession session,
+		FtpRequest request, FtpServerContext context, int code, String subId,
+		String basicMsg, FtpFile from, FtpFile to) {
+		String msg = FtpReplyTranslator.translateMessage(session, request,
+			context, code, subId, basicMsg);
+		return new LocalizedRenameFtpReply(code, msg, from, to);
+	}
+}

http://git-wip-us.apache.org/repos/asf/mina-ftpserver/blob/9769d29a/core/src/main/java/org/apache/ftpserver/ipfilter/MinaSessionFilter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/ftpserver/ipfilter/MinaSessionFilter.java b/core/src/main/java/org/apache/ftpserver/ipfilter/MinaSessionFilter.java
index 3a59f12..ee333b0 100644
--- a/core/src/main/java/org/apache/ftpserver/ipfilter/MinaSessionFilter.java
+++ b/core/src/main/java/org/apache/ftpserver/ipfilter/MinaSessionFilter.java
@@ -1,58 +1,58 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ftpserver.ipfilter;
-
-import org.apache.mina.core.filterchain.IoFilterAdapter;
-import org.apache.mina.core.session.IoSession;
-
-/**
- * A wrapper for <code>SessionFilter</code> so it can be added to the MINA
- * filter chain.
- * 
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- * 
- */
-
-public class MinaSessionFilter extends IoFilterAdapter {
-
-    /**
-     * The actual (or wrapped) <code>SessionFilter</code> used by this filter.
-     */
-    private final SessionFilter filter;
-
-    /**
-     * Creates a new instance of <code>MinaSessionFilter</code>.
-     * 
-     * @param filter
-     *            the filter
-     */
-    public MinaSessionFilter(SessionFilter filter) {
-        this.filter = filter;
-    }
-
-    @Override
-    public void sessionCreated(NextFilter nextFilter, IoSession session) {
-        if (!filter.accept(session)) {
-            session.close(true);
-        } else {
-            nextFilter.sessionCreated(session);
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ftpserver.ipfilter;
+
+import org.apache.mina.core.filterchain.IoFilterAdapter;
+import org.apache.mina.core.session.IoSession;
+
+/**
+ * A wrapper for <code>SessionFilter</code> so it can be added to the MINA
+ * filter chain.
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ * 
+ */
+
+public class MinaSessionFilter extends IoFilterAdapter {
+
+    /**
+     * The actual (or wrapped) <code>SessionFilter</code> used by this filter.
+     */
+    private final SessionFilter filter;
+
+    /**
+     * Creates a new instance of <code>MinaSessionFilter</code>.
+     * 
+     * @param filter
+     *            the filter
+     */
+    public MinaSessionFilter(SessionFilter filter) {
+        this.filter = filter;
+    }
+
+    @Override
+    public void sessionCreated(NextFilter nextFilter, IoSession session) {
+        if (!filter.accept(session)) {
+            session.close(true);
+        } else {
+            nextFilter.sessionCreated(session);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina-ftpserver/blob/9769d29a/core/src/main/java/org/apache/ftpserver/ipfilter/RemoteIpFilter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/ftpserver/ipfilter/RemoteIpFilter.java b/core/src/main/java/org/apache/ftpserver/ipfilter/RemoteIpFilter.java
index a51b159..8a1b036 100644
--- a/core/src/main/java/org/apache/ftpserver/ipfilter/RemoteIpFilter.java
+++ b/core/src/main/java/org/apache/ftpserver/ipfilter/RemoteIpFilter.java
@@ -1,223 +1,223 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ftpserver.ipfilter;
-
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-import org.apache.mina.core.session.IoSession;
-import org.apache.mina.filter.firewall.Subnet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * An implementation of the <code>SessionFilter</code> interface, to filter
- * sessions based on the remote IP address.
- * 
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- * 
- */
-
-public class RemoteIpFilter extends CopyOnWriteArraySet<Subnet> implements
-        SessionFilter {
-
-    /**
-     * Logger
-     */
-    Logger LOGGER = LoggerFactory.getLogger(RemoteIpFilter.class);
-
-    /**
-     * Serial version UID
-     */
-    private static final long serialVersionUID = 4887092372700628783L;
-
-    /**
-     * filter type
-     */
-    private IpFilterType type = null;
-
-    /**
-     * Creates a new instance of <code>RemoteIpFilter</code>.
-     * 
-     * @param type
-     *            the filter type
-     */
-    public RemoteIpFilter(IpFilterType type) {
-        this(type, new HashSet<Subnet>(0));
-    }
-
-    /**
-     * Creates a new instance of <code>RemoteIpFilter</code>.
-     * 
-     * @param type
-     *            the filter type
-     * @param collection
-     *            a collection of <code>Subnet</code>s to filter out/in.
-     */
-    public RemoteIpFilter(IpFilterType type,
-            Collection<? extends Subnet> collection) {
-        super(collection);
-        this.type = type;
-    }
-
-    /**
-     * Creates a new instance of <code>RemoteIpFilter</code>.
-     * 
-     * @param type
-     *            the filter type
-     * @param addresses
-     *            a comma, space, tab, CR, LF separated list of IP
-     *            addresses/CIDRs.
-     * @throws UnknownHostException
-     *             propagated
-     * @throws NumberFormatException
-     *             propagated
-     */
-    public RemoteIpFilter(IpFilterType type, String addresses)
-            throws NumberFormatException, UnknownHostException {
-        super();
-        this.type = type;
-        if (addresses != null) {
-            String[] tokens = addresses.split("[\\s,]+");
-            for (String token : tokens) {
-                if (token.trim().length() > 0) {
-                    add(token);
-                }
-            }
-        }
-        if (LOGGER.isDebugEnabled()) {
-            LOGGER.debug(
-                    "Created DefaultIpFilter of type {} with the subnets {}",
-                    type, this);
-        }
-    }
-
-    /**
-     * Returns the type of this filter.
-     * 
-     * @return the type of this filter.
-     */
-    public IpFilterType getType() {
-        return type;
-    }
-
-    /**
-     * Sets the type of this filter.
-     * 
-     * @param type
-     *            the type of this filter.
-     */
-    public void setType(IpFilterType type) {
-        this.type = type;
-    }
-
-    /**
-     * Adds the given string representation of InetAddress or CIDR notation to
-     * this filter.
-     * 
-     * @param str
-     *            the string representation of InetAddress or CIDR notation
-     * @return if the given element was added or not. <code>true</code>, if the
-     *         given element was added to the filter; <code>false</code>, if the
-     *         element already exists in the filter.
-     * @throws NumberFormatException
-     *             propagated
-     * @throws UnknownHostException
-     *             propagated
-     */
-    public boolean add(String str) throws NumberFormatException,
-            UnknownHostException {
-        // This is required so we do not block loopback address if some one adds
-        // a string with blanks as the InetAddress class assumes loopback
-        // address on a blank string.
-        if (str.trim().length() < 1) {
-            throw new IllegalArgumentException("Invalid IP Address or Subnet: "
-                    + str);
-        }
-        String[] tokens = str.split("/");
-        if (tokens.length == 2) {
-            return add(new Subnet(InetAddress.getByName(tokens[0]), Integer
-                    .parseInt(tokens[1])));
-        } else {
-            return add(new Subnet(InetAddress.getByName(tokens[0]), 32));
-        }
-    }
-
-    public boolean accept(IoSession session) {
-        InetAddress address = ((InetSocketAddress) session.getRemoteAddress())
-                .getAddress();
-        switch (type) {
-        case ALLOW:
-            for (Subnet subnet : this) {
-                if (subnet.inSubnet(address)) {
-                    if (LOGGER.isDebugEnabled()) {
-                        LOGGER
-                                .debug(
-                                        "Allowing connection from {} because it matches with the whitelist subnet {}",
-                                        new Object[] { address, subnet });
-                    }
-                    return true;
-                }
-            }
-            if (LOGGER.isDebugEnabled()) {
-                LOGGER
-                        .debug(
-                                "Denying connection from {} because it does not match any of the whitelist subnets",
-                                new Object[] { address });
-            }
-            return false;
-        case DENY:
-            if (isEmpty()) {
-                if (LOGGER.isDebugEnabled()) {
-                    LOGGER
-                            .debug(
-                                    "Allowing connection from {} because blacklist is empty",
-                                    new Object[] { address });
-                }
-                return true;
-            }
-            for (Subnet subnet : this) {
-                if (subnet.inSubnet(address)) {
-                    if (LOGGER.isDebugEnabled()) {
-                        LOGGER
-                                .debug(
-                                        "Denying connection from {} because it matches with the blacklist subnet {}",
-                                        new Object[] { address, subnet });
-                    }
-                    return false;
-                }
-            }
-            if (LOGGER.isDebugEnabled()) {
-                LOGGER
-                        .debug(
-                                "Allowing connection from {} because it does not match any of the blacklist subnets",
-                                new Object[] { address });
-            }
-            return true;
-        default:
-            throw new RuntimeException("Unknown or unimplemented filter type: "
-                    + type);
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ftpserver.ipfilter;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.firewall.Subnet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An implementation of the <code>SessionFilter</code> interface, to filter
+ * sessions based on the remote IP address.
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ * 
+ */
+
+public class RemoteIpFilter extends CopyOnWriteArraySet<Subnet> implements
+        SessionFilter {
+
+    /**
+     * Logger
+     */
+    Logger LOGGER = LoggerFactory.getLogger(RemoteIpFilter.class);
+
+    /**
+     * Serial version UID
+     */
+    private static final long serialVersionUID = 4887092372700628783L;
+
+    /**
+     * filter type
+     */
+    private IpFilterType type = null;
+
+    /**
+     * Creates a new instance of <code>RemoteIpFilter</code>.
+     * 
+     * @param type
+     *            the filter type
+     */
+    public RemoteIpFilter(IpFilterType type) {
+        this(type, new HashSet<Subnet>(0));
+    }
+
+    /**
+     * Creates a new instance of <code>RemoteIpFilter</code>.
+     * 
+     * @param type
+     *            the filter type
+     * @param collection
+     *            a collection of <code>Subnet</code>s to filter out/in.
+     */
+    public RemoteIpFilter(IpFilterType type,
+            Collection<? extends Subnet> collection) {
+        super(collection);
+        this.type = type;
+    }
+
+    /**
+     * Creates a new instance of <code>RemoteIpFilter</code>.
+     * 
+     * @param type
+     *            the filter type
+     * @param addresses
+     *            a comma, space, tab, CR, LF separated list of IP
+     *            addresses/CIDRs.
+     * @throws UnknownHostException
+     *             propagated
+     * @throws NumberFormatException
+     *             propagated
+     */
+    public RemoteIpFilter(IpFilterType type, String addresses)
+            throws NumberFormatException, UnknownHostException {
+        super();
+        this.type = type;
+        if (addresses != null) {
+            String[] tokens = addresses.split("[\\s,]+");
+            for (String token : tokens) {
+                if (token.trim().length() > 0) {
+                    add(token);
+                }
+            }
+        }
+        if (LOGGER.isDebugEnabled()) {
+            LOGGER.debug(
+                    "Created DefaultIpFilter of type {} with the subnets {}",
+                    type, this);
+        }
+    }
+
+    /**
+     * Returns the type of this filter.
+     * 
+     * @return the type of this filter.
+     */
+    public IpFilterType getType() {
+        return type;
+    }
+
+    /**
+     * Sets the type of this filter.
+     * 
+     * @param type
+     *            the type of this filter.
+     */
+    public void setType(IpFilterType type) {
+        this.type = type;
+    }
+
+    /**
+     * Adds the given string representation of InetAddress or CIDR notation to
+     * this filter.
+     * 
+     * @param str
+     *            the string representation of InetAddress or CIDR notation
+     * @return if the given element was added or not. <code>true</code>, if the
+     *         given element was added to the filter; <code>false</code>, if the
+     *         element already exists in the filter.
+     * @throws NumberFormatException
+     *             propagated
+     * @throws UnknownHostException
+     *             propagated
+     */
+    public boolean add(String str) throws NumberFormatException,
+            UnknownHostException {
+        // This is required so we do not block loopback address if some one adds
+        // a string with blanks as the InetAddress class assumes loopback
+        // address on a blank string.
+        if (str.trim().length() < 1) {
+            throw new IllegalArgumentException("Invalid IP Address or Subnet: "
+                    + str);
+        }
+        String[] tokens = str.split("/");
+        if (tokens.length == 2) {
+            return add(new Subnet(InetAddress.getByName(tokens[0]), Integer
+                    .parseInt(tokens[1])));
+        } else {
+            return add(new Subnet(InetAddress.getByName(tokens[0]), 32));
+        }
+    }
+
+    public boolean accept(IoSession session) {
+        InetAddress address = ((InetSocketAddress) session.getRemoteAddress())
+                .getAddress();
+        switch (type) {
+        case ALLOW:
+            for (Subnet subnet : this) {
+                if (subnet.inSubnet(address)) {
+                    if (LOGGER.isDebugEnabled()) {
+                        LOGGER
+                                .debug(
+                                        "Allowing connection from {} because it matches with the whitelist subnet {}",
+                                        new Object[] { address, subnet });
+                    }
+                    return true;
+                }
+            }
+            if (LOGGER.isDebugEnabled()) {
+                LOGGER
+                        .debug(
+                                "Denying connection from {} because it does not match any of the whitelist subnets",
+                                new Object[] { address });
+            }
+            return false;
+        case DENY:
+            if (isEmpty()) {
+                if (LOGGER.isDebugEnabled()) {
+                    LOGGER
+                            .debug(
+                                    "Allowing connection from {} because blacklist is empty",
+                                    new Object[] { address });
+                }
+                return true;
+            }
+            for (Subnet subnet : this) {
+                if (subnet.inSubnet(address)) {
+                    if (LOGGER.isDebugEnabled()) {
+                        LOGGER
+                                .debug(
+                                        "Denying connection from {} because it matches with the blacklist subnet {}",
+                                        new Object[] { address, subnet });
+                    }
+                    return false;
+                }
+            }
+            if (LOGGER.isDebugEnabled()) {
+                LOGGER
+                        .debug(
+                                "Allowing connection from {} because it does not match any of the blacklist subnets",
+                                new Object[] { address });
+            }
+            return true;
+        default:
+            throw new RuntimeException("Unknown or unimplemented filter type: "
+                    + type);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina-ftpserver/blob/9769d29a/core/src/test/java/org/apache/ftpserver/clienttests/ActiveModeReplyTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/ftpserver/clienttests/ActiveModeReplyTest.java b/core/src/test/java/org/apache/ftpserver/clienttests/ActiveModeReplyTest.java
index 9d1138f..ed02174 100644
--- a/core/src/test/java/org/apache/ftpserver/clienttests/ActiveModeReplyTest.java
+++ b/core/src/test/java/org/apache/ftpserver/clienttests/ActiveModeReplyTest.java
@@ -1,79 +1,79 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ftpserver.clienttests;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.commons.net.ftp.FTPClient;
-import org.apache.commons.net.ftp.FTPClientConfig;
-import org.apache.ftpserver.test.TestUtil;
-
-/**
-*
-* @author <a href="http://mina.apache.org">Apache MINA Project</a>
-*
-*/
-public class ActiveModeReplyTest extends ClientTestTemplate {
-    private static final File TEST_TMP_DIR = new File("test-tmp");
-
-    private static final File TEST_FILE = new File(ROOT_DIR, "test.txt");
-
-    private static final File TEST_FILE1 = new File(TEST_TMP_DIR, "test1.txt");
-
-    private static byte[] testData;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        TEST_FILE1.createNewFile();
-        assertTrue(TEST_FILE1.exists());
-
-        testData = ("TESTDATA").getBytes("UTF-8");
-        TestUtil.writeDataToFile(TEST_FILE, testData);
-        assertTrue(TEST_FILE.exists());
-
-        FTPClientConfig config = new FTPClientConfig("UNIX");
-        client.configure(config);
-
-        client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
-    }
-
-    public void testStoreInActiveModeIfNotAllowed() throws Exception {
-        assertTrue(client.getDataConnectionMode() == FTPClient.ACTIVE_LOCAL_DATA_CONNECTION_MODE);
-
-        sendCommand("APPE " + TEST_FILE1.getAbsolutePath());
-        sendCommand("LIST");
-        sendCommand("MLSD");
-        sendCommand("NLST");
-        sendCommand("RETR " + TEST_FILE.getName());
-        sendCommand("STOR " + TEST_FILE1.getAbsolutePath());
-        sendCommand("STOU");
-    }
-
-    private void sendCommand(final String command) throws IOException {
-        final int returnCode = client.sendCommand(command);
-        assertEquals(503, returnCode);
-        assertEquals("503 PORT or PASV must be issued first", client
-                .getReplyString().trim());
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ftpserver.clienttests;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.net.ftp.FTPClientConfig;
+import org.apache.ftpserver.test.TestUtil;
+
+/**
+*
+* @author <a href="http://mina.apache.org">Apache MINA Project</a>
+*
+*/
+public class ActiveModeReplyTest extends ClientTestTemplate {
+    private static final File TEST_TMP_DIR = new File("test-tmp");
+
+    private static final File TEST_FILE = new File(ROOT_DIR, "test.txt");
+
+    private static final File TEST_FILE1 = new File(TEST_TMP_DIR, "test1.txt");
+
+    private static byte[] testData;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        TEST_FILE1.createNewFile();
+        assertTrue(TEST_FILE1.exists());
+
+        testData = ("TESTDATA").getBytes("UTF-8");
+        TestUtil.writeDataToFile(TEST_FILE, testData);
+        assertTrue(TEST_FILE.exists());
+
+        FTPClientConfig config = new FTPClientConfig("UNIX");
+        client.configure(config);
+
+        client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
+    }
+
+    public void testStoreInActiveModeIfNotAllowed() throws Exception {
+        assertTrue(client.getDataConnectionMode() == FTPClient.ACTIVE_LOCAL_DATA_CONNECTION_MODE);
+
+        sendCommand("APPE " + TEST_FILE1.getAbsolutePath());
+        sendCommand("LIST");
+        sendCommand("MLSD");
+        sendCommand("NLST");
+        sendCommand("RETR " + TEST_FILE.getName());
+        sendCommand("STOR " + TEST_FILE1.getAbsolutePath());
+        sendCommand("STOU");
+    }
+
+    private void sendCommand(final String command) throws IOException {
+        final int returnCode = client.sendCommand(command);
+        assertEquals(503, returnCode);
+        assertEquals("503 PORT or PASV must be issued first", client
+                .getReplyString().trim());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/mina-ftpserver/blob/9769d29a/core/src/test/java/org/apache/ftpserver/clienttests/PasvAddressWithOverridenHostnameGetter.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/ftpserver/clienttests/PasvAddressWithOverridenHostnameGetter.java b/core/src/test/java/org/apache/ftpserver/clienttests/PasvAddressWithOverridenHostnameGetter.java
index 1d0419e..f5e9409 100644
--- a/core/src/test/java/org/apache/ftpserver/clienttests/PasvAddressWithOverridenHostnameGetter.java
+++ b/core/src/test/java/org/apache/ftpserver/clienttests/PasvAddressWithOverridenHostnameGetter.java
@@ -1,73 +1,73 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ftpserver.clienttests;
-
-import org.apache.ftpserver.DataConnectionConfigurationFactory;
-import org.apache.ftpserver.FtpServerFactory;
-import org.apache.ftpserver.command.CommandFactoryFactory;
-import org.apache.ftpserver.command.impl.PASV;
-import org.apache.ftpserver.impl.FtpIoSession;
-import org.apache.ftpserver.listener.ListenerFactory;
-
-/**
- * Test for external passive address configured as hostname rather than IP
- * address.
- *
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- * @version $Rev$, $Date$
- *
- */
-public class PasvAddressWithOverridenHostnameGetter extends ClientTestTemplate {
-
-    class PASVTest extends PASV{
-
-        @Override
-        protected String getPassiveExternalAddress(FtpIoSession session) {
-            return "10.10.10.10";
-        }
-        
-    }
-    @Override
-    protected FtpServerFactory createServer() throws Exception {
-        FtpServerFactory server = super.createServer();
-
-        ListenerFactory listenerFactory = new ListenerFactory(server.getListener("default"));
-        
-        DataConnectionConfigurationFactory dccFactory = new DataConnectionConfigurationFactory();
-
-        dccFactory.setPassiveExternalAddress("127.0.0.1");
-
-        listenerFactory.setDataConnectionConfiguration(dccFactory.createDataConnectionConfiguration());
-
-        server.addListener("default", listenerFactory.createListener());
-        CommandFactoryFactory cmFact = new CommandFactoryFactory();
-        cmFact.setUseDefaultCommands(true);
-        cmFact.addCommand("PASV", new PASVTest());
-        server.setCommandFactory(cmFact.createCommandFactory());
-        return server;
-    }
-
-    public void testPasvAddress() throws Exception {
-        client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
-        client.pasv();
-
-        assertTrue(client.getReplyString().indexOf("(10,10,10,10,") > -1);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ftpserver.clienttests;
+
+import org.apache.ftpserver.DataConnectionConfigurationFactory;
+import org.apache.ftpserver.FtpServerFactory;
+import org.apache.ftpserver.command.CommandFactoryFactory;
+import org.apache.ftpserver.command.impl.PASV;
+import org.apache.ftpserver.impl.FtpIoSession;
+import org.apache.ftpserver.listener.ListenerFactory;
+
+/**
+ * Test for external passive address configured as hostname rather than IP
+ * address.
+ *
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ * @version $Rev$, $Date$
+ *
+ */
+public class PasvAddressWithOverridenHostnameGetter extends ClientTestTemplate {
+
+    class PASVTest extends PASV{
+
+        @Override
+        protected String getPassiveExternalAddress(FtpIoSession session) {
+            return "10.10.10.10";
+        }
+        
+    }
+    @Override
+    protected FtpServerFactory createServer() throws Exception {
+        FtpServerFactory server = super.createServer();
+
+        ListenerFactory listenerFactory = new ListenerFactory(server.getListener("default"));
+        
+        DataConnectionConfigurationFactory dccFactory = new DataConnectionConfigurationFactory();
+
+        dccFactory.setPassiveExternalAddress("127.0.0.1");
+
+        listenerFactory.setDataConnectionConfiguration(dccFactory.createDataConnectionConfiguration());
+
+        server.addListener("default", listenerFactory.createListener());
+        CommandFactoryFactory cmFact = new CommandFactoryFactory();
+        cmFact.setUseDefaultCommands(true);
+        cmFact.addCommand("PASV", new PASVTest());
+        server.setCommandFactory(cmFact.createCommandFactory());
+        return server;
+    }
+
+    public void testPasvAddress() throws Exception {
+        client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
+        client.pasv();
+
+        assertTrue(client.getReplyString().indexOf("(10,10,10,10,") > -1);
+    }
+}