[ 
https://issues.apache.org/jira/browse/FTPSERVER-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12593301#action_12593301
 ] 

Niklas Gustavsson commented on FTPSERVER-131:
---------------------------------------------

That's a good question, does the following patch to commons-net fix your broken 
tests?

Index: src/main/java/org/apache/commons/net/ftp/FTP.java
===================================================================
--- src/main/java/org/apache/commons/net/ftp/FTP.java   (revision 652071)
+++ src/main/java/org/apache/commons/net/ftp/FTP.java   (working copy)
@@ -487,7 +487,21 @@
         if (_commandSupport_.getListenerCount() > 0)
             _commandSupport_.fireCommandSent(command, message);
 
-        __getReply();
+        try {
+            __getReply();
+        }
+        catch (SocketException e)
+        {
+            if (!isConnected() || !socketIsConnected(_socket_))
+            {
+                throw new FTPConnectionClosedException("Connection 
unexpectedly closed.");
+            }
+            else
+            {
+                throw e;
+            }
+        }
+
         return _replyCode;
     }

Another option would be to update our tests to also accept a thrown 
SocketException as a successful result.

> FtpLet test failures
> --------------------
>
>                 Key: FTPSERVER-131
>                 URL: https://issues.apache.org/jira/browse/FTPSERVER-131
>             Project: FtpServer
>          Issue Type: Bug
>          Components: Ftplets
>         Environment: win XP, jdk1.5.0_15
>            Reporter: Magnus Grimsell
>            Priority: Minor
>         Attachments: 
> org.apache.ftpserver.ftplet.FtpLetReturnDisconnectTest.txt, 
> org.apache.ftpserver.ftplet.FtpLetThrowFtpExceptionTest.txt, 
> org.apache.ftpserver.ftplet.FtpLetThrowRuntimeExceptionTest.txt
>
>
> When building ftpserver projekt from trunk I get the following test failures:
> Tests in error: 
>   
> testExceptionDuringUploadEnd(org.apache.ftpserver.ftplet.FtpLetThrowRuntimeExceptionTest)
>   
> testExceptionDuringUploadUniqueEnd(org.apache.ftpserver.ftplet.FtpLetThrowRuntimeExceptionTest)
>   
> testExceptionDuringAppendEnd(org.apache.ftpserver.ftplet.FtpLetThrowFtpExceptionTest)
>   
> testExceptionDuringUploadUniqueEnd(org.apache.ftpserver.ftplet.FtpLetThrowFtpExceptionTest)
>   
> testExceptionDuringDownloadEnd(org.apache.ftpserver.ftplet.FtpLetReturnDisconnectTest)
>   
> testExceptionDuringAppendEnd(org.apache.ftpserver.ftplet.FtpLetReturnDisconnectTest)
>   
> testExceptionDuringUploadEnd(org.apache.ftpserver.ftplet.FtpLetReturnDisconnectTest)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to