FtpServer
  1. FtpServer
  2. FTPSERVER-153

XML config local-address element does not set server address correctly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0-M2
    • Fix Version/s: 1.0.0-M3
    • Component/s: None
    • Labels:
      None

      Description

      The documentation example on the page http://mina.apache.org/ftpserver/listeners.html

      shows the "local-address" attribute for the <nio-listener> element. But this results in an exception:

      org.springframework.beans.InvalidPropertyException: Invalid property 'localAddress' of bean class [org.apache.ftpserver.listener.nio.NioListener]: No property 'localAddress' found

      I checked the code of the NioListener and AbstractListener class and there is a setServerAddress() method. So I tried <nio-listener server-address="..."> instead, but now the XML file doesn't validate against ftpserver-1.0.xsd. I have also tried to change the "local-address" to "server-address" in ftpserver-1.0.xsd. Now, I don't get any exceptions but the server address is still not set. This, I think, is because the ListenerBeanDefinitionParser class is looking for local-address attribute. Am I correct about this and may the following change to the ListenerBeanDefinitionParser class fix this problem?

      InetAddress serverAddress = SpringUtil.parseInetAddress(element, "server-address");
      if(serverAddress != null)

      { builder.addPropertyValue("serverAddress", serverAddress); }

      If so, I may try to provide a patch, but it will not be until next week.

        Activity

        Hide
        Niklas Gustavsson added a comment -

        Fixed and test added. XML schema unchanged, setting local-address should now work.

        svn commit "/media/big/home/svn/apache/ftpserver-trunk/core/src/main/java/org/apache/ftpserver/config/spring/ListenerBeanDefinitionParser.java" "/media/big/home/svn/apache/ftpserver-trunk/core/src/test/java/org/apache/ftpserver/config/spring/SpringConfigTest.java" "/media/big/home/svn/apache/ftpserver-trunk/core/src/test/resources/spring-config/config-spring-1.xml" -N -m "Setting the correct property on NioListener for local addressn (FTPSERVER-153)" --username "ngn"
        M /media/big/home/svn/apache/ftpserver-trunk/core/src/main/java/org/apache/ftpserver/config/spring/ListenerBeanDefinitionParser.java
        M /media/big/home/svn/apache/ftpserver-trunk/core/src/test/java/org/apache/ftpserver/config/spring/SpringConfigTest.java
        M /media/big/home/svn/apache/ftpserver-trunk/core/src/test/resources/spring-config/config-spring-1.xml
        Transmitting file data: /media/big/home/svn/apache/ftpserver-trunk/core/src/main/java/org/apache/ftpserver/config/spring/ListenerBeanDefinitionParser.java
        Transmitting file data: /media/big/home/svn/apache/ftpserver-trunk/core/src/test/java/org/apache/ftpserver/config/spring/SpringConfigTest.java
        Transmitting file data: /media/big/home/svn/apache/ftpserver-trunk/core/src/test/resources/spring-config/config-spring-1.xml
        Committed revision 685522

        Show
        Niklas Gustavsson added a comment - Fixed and test added. XML schema unchanged, setting local-address should now work. svn commit "/media/big/home/svn/apache/ftpserver-trunk/core/src/main/java/org/apache/ftpserver/config/spring/ListenerBeanDefinitionParser.java" "/media/big/home/svn/apache/ftpserver-trunk/core/src/test/java/org/apache/ftpserver/config/spring/SpringConfigTest.java" "/media/big/home/svn/apache/ftpserver-trunk/core/src/test/resources/spring-config/config-spring-1.xml" -N -m "Setting the correct property on NioListener for local addressn ( FTPSERVER-153 )" --username "ngn" M /media/big/home/svn/apache/ftpserver-trunk/core/src/main/java/org/apache/ftpserver/config/spring/ListenerBeanDefinitionParser.java M /media/big/home/svn/apache/ftpserver-trunk/core/src/test/java/org/apache/ftpserver/config/spring/SpringConfigTest.java M /media/big/home/svn/apache/ftpserver-trunk/core/src/test/resources/spring-config/config-spring-1.xml Transmitting file data: /media/big/home/svn/apache/ftpserver-trunk/core/src/main/java/org/apache/ftpserver/config/spring/ListenerBeanDefinitionParser.java Transmitting file data: /media/big/home/svn/apache/ftpserver-trunk/core/src/test/java/org/apache/ftpserver/config/spring/SpringConfigTest.java Transmitting file data: /media/big/home/svn/apache/ftpserver-trunk/core/src/test/resources/spring-config/config-spring-1.xml Committed revision 685522

          People

          • Assignee:
            Niklas Gustavsson
            Reporter:
            Niklas Gustavsson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development