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 'ip-filter' instead. ");
try {
DefaultIpFilter ipFilter = new DefaultIpFilter(IpFilterType.DENY, blacklistElm.getTextContent());
factoryBuilder.addPropertyValue("ipFilter", ipFilter);
}
catch (UnknownHostException e) {
throw new IllegalArgumentException("Invalid IP address or subnet in the 'blacklist' element", e);
}
}
Element ipFilterElement = SpringUtil.getChildElement(element, FtpServerNamespaceHandler.FTPSERVER_NS, "ip-filter");
if(ipFilterElement != null) {
if(blacklistElm != null) {
throw new FtpServerConfigurationException("Element 'ipFilter' may not be used when 'blacklist' element is specified. ");
}
String filterType = ipFilterElement.getAttribute("type");
try {
DefaultIpFilter ipFilter = new DefaultIpFilter(IpFilterType.parse(filterType), ipFilterElement.getTextContent());
factoryBuilder.addPropertyValue("ipFilter", ipFilter);
}
catch (UnknownHostException e) {
throw new IllegalArgumentException("Invalid IP address or subnet in the 'ip-filter' element");
}