https://bz.apache.org/bugzilla/show_bug.cgi?id=64086
--- Comment #10 from Kais hamdulay <[email protected]> --- I have found the solution for the issue,. The issue was with the reading of file from ftp client Below settings are recommended to avoid falling into this issue from FTPClient Before every file read or write we need to set the ftpClient.setFileType(FTP.BINARY_FILE_TYPE) which is very important and solved my issue ftpClient = getFTPClient(); ftpClient.setConnectTimeout(connectionTimeout); ftpClient.connect(url, port); ftpClient.enterLocalPassiveMode(); ftpClient.setControlEncoding("UTF-8"); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); //login if (!ftpClient.login(ftpAuth[0], ftpAuth[1])) { ftpClient.logout(); } for (FTPFile ftpFile : result) { boolean canDownload = this.isFileEligibleForDownload(merchantImportSetup, ftpFile); if (ftpFile.isFile() && canDownload) { 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 outputStream = new BufferedOutputStream(new FileOutputStream(localPath)); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); ftpClient.retrieveFile(remoteFile, outputStream); //since file is already copied into local file system , upload it to OSS log.info(merchantImportSetup.getFriendlyImportName() + "-" + "file is downloaded from FTP at " + localPath.getAbsolutePath()); String ossPath = merchantCatalogImporterFileService.uploadToOSS(merchantImportSetup, localPath); log.info(merchantImportSetup.getFriendlyImportName() + "-" + "file is uploaded to OSS at " + ossPath); downloadFile = localPath; IOUtils.closeQuietly(outputStream); break; } } -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
