https://bz.apache.org/bugzilla/show_bug.cgi?id=64086

--- Comment #9 from Kais hamdulay <kaishamdu...@gmail.com> ---
Hi I checked the md5 and its coming different for the file on windows and the
other one that i had copied using winscp to the ftp server and later on read
the file from ftp using FTPClient and written that file on linux server local
path from where i am reading it.
I have checked from the code perspective its  perfect as i am setting the file
type as binary while reading the file from ftp and writing the bytes to
destination file using below code.
Howevr,I am not sure what is going wrong here


 for (FTPFile ftpFile : result) {
                boolean canDownload =
this.isFileEligibleForDownload(merchantImportSetup, ftpFile);
                if (ftpFile.isFile() && canDownload) {
                    ftpFile.setType(FTPSClient.BINARY_FILE_TYPE);
                    log.info("Save the file to db");
                    log.info("file to be read from ftp location is : " +
ftpFile.getName());
                    String remoteFile = "/" +
merchantImportSetup.getDirectory() + "/" + ftpFile.getName();
                    File localPath = new File(fileSystemBaseDirectory +
File.separator +
merchantCatalogImporterFileService.getRandomizedFile(ftpFile.getName()));
                    OutputStream outputStream2 = new BufferedOutputStream(new
FileOutputStream(localPath));
                    InputStream inputStream =
ftpClient.retrieveFileStream(remoteFile);
                    byte[] bytesArray = new byte[4096];
                    int bytesRead = -1;
                    while ((bytesRead = inputStream.read(bytesArray)) != -1) {
                        outputStream2.write(bytesArray, 0, bytesRead);
                    }
                    boolean success = ftpClient.completePendingCommand();
                    if (success) {
                        System.out.println("File #2 has been downloaded
successfully.");
                    }
                    outputStream2.close();
                    inputStream.close();  

}

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to