[jira] [Created] (NET-409) FTPClient truncates file (storeFile method)

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (NET-409) FTPClient truncates file (storeFile method)

Gilles (Jira)
FTPClient truncates file (storeFile method)
-------------------------------------------

                 Key: NET-409
                 URL: https://issues.apache.org/jira/browse/NET-409
             Project: Commons Net
          Issue Type: Bug
          Components: FTP
    Affects Versions: 3.0
         Environment: Windows 7/Eclipse 3.6.2
            Reporter: Jon Ericson
             Fix For: 3.0


Functionality works fine on commons-net-2.2.  Error occurred after upgrading library to commons-net-3.3 version.  Sending a file from Windows 7 to CentOS/Linux using FTPClient storeFile method results in truncation of files over 2k in size.  Rolling back upgrade to commons-net-2.2 version fixes problem.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (NET-409) FTPClient truncates file (storeFile method)

Gilles (Jira)

     [ https://issues.apache.org/jira/browse/NET-409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jon Ericson updated NET-409:
----------------------------

    Description: Functionality works fine on commons-net-2.2.  Error occurred after upgrading library to commons-net-3.0 version.  Sending a file from Windows 7 to CentOS/Linux using FTPClient storeFile method results in truncation of files over 2k in size.  Rolling back upgrade to commons-net-2.2 version fixes problem.  (was: Functionality works fine on commons-net-2.2.  Error occurred after upgrading library to commons-net-3.3 version.  Sending a file from Windows 7 to CentOS/Linux using FTPClient storeFile method results in truncation of files over 2k in size.  Rolling back upgrade to commons-net-2.2 version fixes problem.)

> FTPClient truncates file (storeFile method)
> -------------------------------------------
>
>                 Key: NET-409
>                 URL: https://issues.apache.org/jira/browse/NET-409
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.0
>         Environment: Windows 7/Eclipse 3.6.2
>            Reporter: Jon Ericson
>             Fix For: 3.0
>
>
> Functionality works fine on commons-net-2.2.  Error occurred after upgrading library to commons-net-3.0 version.  Sending a file from Windows 7 to CentOS/Linux using FTPClient storeFile method results in truncation of files over 2k in size.  Rolling back upgrade to commons-net-2.2 version fixes problem.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (NET-409) FTPClient truncates file (storeFile method)

Gilles (Jira)
In reply to this post by Gilles (Jira)

     [ https://issues.apache.org/jira/browse/NET-409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated NET-409:
---------------------

    Fix Version/s:     (was: 3.0)

> FTPClient truncates file (storeFile method)
> -------------------------------------------
>
>                 Key: NET-409
>                 URL: https://issues.apache.org/jira/browse/NET-409
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.0
>         Environment: Windows 7/Eclipse 3.6.2
>            Reporter: Jon Ericson
>
> Functionality works fine on commons-net-2.2.  Error occurred after upgrading library to commons-net-3.0 version.  Sending a file from Windows 7 to CentOS/Linux using FTPClient storeFile method results in truncation of files over 2k in size.  Rolling back upgrade to commons-net-2.2 version fixes problem.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (NET-409) FTPClient truncates file (storeFile method)

Gilles (Jira)
In reply to this post by Gilles (Jira)

    [ https://issues.apache.org/jira/browse/NET-409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13037092#comment-13037092 ]

Sebb commented on NET-409:
--------------------------

Works fine for me. You'll need to provide sample code that fails on 3.0 and works with 2.2.

Please try using the example code as follows:

java examples.ftp.FTPClientExample -s <host> <user> <password> <remotefile> <localfile>



> FTPClient truncates file (storeFile method)
> -------------------------------------------
>
>                 Key: NET-409
>                 URL: https://issues.apache.org/jira/browse/NET-409
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.0
>         Environment: Windows 7/Eclipse 3.6.2
>            Reporter: Jon Ericson
>
> Functionality works fine on commons-net-2.2.  Error occurred after upgrading library to commons-net-3.0 version.  Sending a file from Windows 7 to CentOS/Linux using FTPClient storeFile method results in truncation of files over 2k in size.  Rolling back upgrade to commons-net-2.2 version fixes problem.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (NET-409) FTPClient truncates file (storeFile method)

Gilles (Jira)
In reply to this post by Gilles (Jira)

    [ https://issues.apache.org/jira/browse/NET-409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038109#comment-13038109 ]

Jon Ericson commented on NET-409:
---------------------------------

Per your request, the following sample class demonstrates the issue.  My original description is not entirely accurate; it is not files over 2k in size that is truncated, but instead the file size "rounds down" to the nearest 1k and truncates the rest.

The "Declaration.txt" file used in this example is the U.S. Declaration of Independence.  It is 7.94KB on my local drive in Windows.  On arriving at the server, it is only 7K, truncating the last few sentences.

Truncation occurs when the commons-net-3.0.jar is used.  Changing the .jar on the class path to use the commons-net-2.2.jar, the file is transmitted in its entirety.

###

package com.jericson.stuff;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.FileReader;
import java.io.InputStream;
import org.apache.commons.net.ftp.FTPClient;

public class Net_409_Demo {

  /**
   * @param args
   */
  public static void main(String[] args) {
    String independence = getStringFromFile();
    FTPClient ftpClient = new FTPClient();
    try {
      ftpClient.connect("b2b.myserver.com");
      ftpClient.login("testuser", "Testpassword");
      InputStream stream = new ByteArrayInputStream(
              independence.getBytes("UTF-8"));
      ftpClient.storeFile("Independence.txt", stream);
      ftpClient.quit();
      ftpClient.disconnect();
    } catch (Exception e) {
      e.printStackTrace();
    }
    System.out.println("** Complete **");
  }

  private static String getStringFromFile() {

    /*
     * The file "Declaration.txt" begins with <Declaration>, ends with
     * </Declaration> and has no line separators in between.
     */
    try {
      BufferedReader reader = new BufferedReader(new FileReader(
              "Declaration.txt"));
      StringBuilder stringBuilder = new StringBuilder();
      stringBuilder.append(reader.readLine());
      return stringBuilder.toString();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
}

###
 



> FTPClient truncates file (storeFile method)
> -------------------------------------------
>
>                 Key: NET-409
>                 URL: https://issues.apache.org/jira/browse/NET-409
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.0
>         Environment: Windows 7/Eclipse 3.6.2
>            Reporter: Jon Ericson
>
> Functionality works fine on commons-net-2.2.  Error occurred after upgrading library to commons-net-3.0 version.  Sending a file from Windows 7 to CentOS/Linux using FTPClient storeFile method results in truncation of files over 2k in size.  Rolling back upgrade to commons-net-2.2 version fixes problem.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (NET-409) FTPClient truncates file (storeFile method)

Gilles (Jira)
In reply to this post by Gilles (Jira)

     [ https://issues.apache.org/jira/browse/NET-409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved NET-409.
----------------------

    Resolution: Fixed

That explains why my test worked and yours did not. As it happens, the file I used was a multiple of 2k bytes, so the error was not exposed.

Code has been fixed now, and will be in the next release.

I'll upload 3.0.1 SNAPSHOT shortly if you want to try that.

> FTPClient truncates file (storeFile method)
> -------------------------------------------
>
>                 Key: NET-409
>                 URL: https://issues.apache.org/jira/browse/NET-409
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.0
>         Environment: Windows 7/Eclipse 3.6.2
>            Reporter: Jon Ericson
>
> Functionality works fine on commons-net-2.2.  Error occurred after upgrading library to commons-net-3.0 version.  Sending a file from Windows 7 to CentOS/Linux using FTPClient storeFile method results in truncation of files over 2k in size.  Rolling back upgrade to commons-net-2.2 version fixes problem.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (NET-409) FTPClient truncates file (storeFile method)

Gilles (Jira)
In reply to this post by Gilles (Jira)

     [ https://issues.apache.org/jira/browse/NET-409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated NET-409:
---------------------

    Fix Version/s: 3.0.1

> FTPClient truncates file (storeFile method)
> -------------------------------------------
>
>                 Key: NET-409
>                 URL: https://issues.apache.org/jira/browse/NET-409
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.0
>         Environment: Windows 7/Eclipse 3.6.2
>            Reporter: Jon Ericson
>             Fix For: 3.0.1
>
>
> Functionality works fine on commons-net-2.2.  Error occurred after upgrading library to commons-net-3.0 version.  Sending a file from Windows 7 to CentOS/Linux using FTPClient storeFile method results in truncation of files over 2k in size.  Rolling back upgrade to commons-net-2.2 version fixes problem.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Issue Comment Edited] (NET-409) FTPClient truncates file (storeFile method)

Gilles (Jira)
In reply to this post by Gilles (Jira)

    [ https://issues.apache.org/jira/browse/NET-409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038171#comment-13038171 ]

Sebb edited comment on NET-409 at 5/23/11 8:02 PM:
---------------------------------------------------

That explains why my test worked and yours did not. As it happens, the file I used was a multiple of 2k bytes, so the error was not exposed.

Code has been fixed now, and will be in the next release.

Snapshot has been uploaded to https://repository.apache.org/content/repositories/snapshots/commons-net/commons-net/3.0.1-SNAPSHOT/

Thanks for reporting the issue.

      was (Author: [hidden email]):
    That explains why my test worked and yours did not. As it happens, the file I used was a multiple of 2k bytes, so the error was not exposed.

Code has been fixed now, and will be in the next release.

I'll upload 3.0.1 SNAPSHOT shortly if you want to try that.
 

> FTPClient truncates file (storeFile method)
> -------------------------------------------
>
>                 Key: NET-409
>                 URL: https://issues.apache.org/jira/browse/NET-409
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.0
>         Environment: Windows 7/Eclipse 3.6.2
>            Reporter: Jon Ericson
>             Fix For: 3.0.1
>
>
> Functionality works fine on commons-net-2.2.  Error occurred after upgrading library to commons-net-3.0 version.  Sending a file from Windows 7 to CentOS/Linux using FTPClient storeFile method results in truncation of files over 2k in size.  Rolling back upgrade to commons-net-2.2 version fixes problem.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Closed] (NET-409) FTPClient truncates file (storeFile method)

Gilles (Jira)
In reply to this post by Gilles (Jira)

     [ https://issues.apache.org/jira/browse/NET-409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb closed NET-409.
--------------------

   

> FTPClient truncates file (storeFile method)
> -------------------------------------------
>
>                 Key: NET-409
>                 URL: https://issues.apache.org/jira/browse/NET-409
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 3.0
>         Environment: Windows 7/Eclipse 3.6.2
>            Reporter: Jon Ericson
>             Fix For: 3.0.1
>
>
> Functionality works fine on commons-net-2.2.  Error occurred after upgrading library to commons-net-3.0 version.  Sending a file from Windows 7 to CentOS/Linux using FTPClient storeFile method results in truncation of files over 2k in size.  Rolling back upgrade to commons-net-2.2 version fixes problem.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira