Author: ngn
Date: Sat Feb 14 21:06:04 2009
New Revision: 744569

URL: http://svn.apache.org/viewvc?rev=744569&view=rev
Log:
Fixing issue where NioListener.getPort() is not updated on resume when using a 
dynamic port (FTPSERVER-275)

Modified:
    
mina/ftpserver/branches/1.0.x/core/src/main/java/org/apache/ftpserver/listener/nio/NioListener.java

Modified: 
mina/ftpserver/branches/1.0.x/core/src/main/java/org/apache/ftpserver/listener/nio/NioListener.java
URL: 
http://svn.apache.org/viewvc/mina/ftpserver/branches/1.0.x/core/src/main/java/org/apache/ftpserver/listener/nio/NioListener.java?rev=744569&r1=744568&r2=744569&view=diff
==============================================================================
--- 
mina/ftpserver/branches/1.0.x/core/src/main/java/org/apache/ftpserver/listener/nio/NioListener.java
 (original)
+++ 
mina/ftpserver/branches/1.0.x/core/src/main/java/org/apache/ftpserver/listener/nio/NioListener.java
 Sat Feb 14 21:06:04 2009
@@ -183,9 +183,9 @@
             } catch (IOException e) {
                 throw new FtpServerConfigurationException("Failed to bind to 
address " + address + ", check configuration", e);
             }
+            
+            updatePort();
     
-            // update the port to the real port bound by the listener
-            setPort(acceptor.getLocalAddress().getPort());
         } catch(RuntimeException e) {
             // clean up if we fail to start
             stop();
@@ -193,6 +193,11 @@
             throw e;
         }
     }
+    
+    private void updatePort() {
+        // update the port to the real port bound by the listener
+        setPort(acceptor.getLocalAddress().getPort());
+    }
 
     /**
      * @see Listener#stop()
@@ -242,6 +247,8 @@
                 LOG.debug("Resuming listener");
                 acceptor.bind(address);
                 LOG.debug("Listener resumed");
+                
+                updatePort();
             } catch (IOException e) {
                 LOG.error("Failed to resume listener", e);
             }


Reply via email to