Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2B4CFE6F9 for ; Fri, 1 Feb 2013 20:48:14 +0000 (UTC) Received: (qmail 60786 invoked by uid 500); 1 Feb 2013 20:48:13 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 60699 invoked by uid 500); 1 Feb 2013 20:48:13 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 60690 invoked by uid 99); 1 Feb 2013 20:48:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Feb 2013 20:48:13 +0000 Date: Fri, 1 Feb 2013 20:48:13 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (NET-498) CLONE - Retrieving files from AS400 FTP systems returns null timestamps in FTPFile.getTimestamp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/NET-498?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sebb updated NET-498: --------------------- Description: We are trying to list files from AS400 systems and retrieve the timestamps from these files using the following code: {code} import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.net.InetAddress; import java.net.UnknownHostException; import org.apache.commons.net.PrintCommandListener; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPHTTPClient; import org.apache.commons.net.ftp.FTPClientConfig; import org.apache.commons.net.ftp.FTPConnectionClosedException; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPReply; import org.apache.commons.net.ftp.FTPSClient; import org.apache.commons.net.io.CopyStreamEvent; import org.apache.commons.net.io.CopyStreamListener; import org.apache.commons.net.util.TrustManagerUtils; public final class FTPAccess { private String server; private String username; private String password; private String path ; public String getPath() { return path; } public void setPath(String path) { this.path = path; } public static void main(String[] args) throws UnknownHostException { FTPAccess ftpAccess = new FTPAccess(); ftpAccess.setServer("X.X.X.X"); ftpAccess.setUsername("XXXXXX"); ftpAccess.setPassword(XXXXXXX"); ftpAccess.setPath("/reports"); ftpAccess.getFile(); } public void getFile() throws UnknownHostException { FTPClient ftpClient = new FTPClient(); try { InetAddress serveIPAddress = InetAddress.getByName(server); ftpClient.setPassiveLocalIPAddress(serveIPAddress); ftpClient.connect(serveIPAddress); System.out.println("Connected to " + server + "."); int reply = ftpClient.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { System.err.println("FTP server refused connection."); System.err.println(ftpClient.getReplyString()); ftpClient.disconnect(); } else { } if (!ftpClient.login(username, password)) { System.out.println(ftpClient.getReplyString()); ftpClient.logout(); } else{ diplayContent(ftpClient, path); } } catch (IOException e) { if (ftpClient.isConnected()) { try { ftpClient.disconnect(); } catch (IOException ioException) { // do nothing } } System.err.println("Could not connect to server."); // e.printStackTrace(); System.exit(1); } // } catch (FTPConnectionClosedException e) { // error = true; // System.err.println("Server closed connection."); // e.printStackTrace(); // } catch (IOException e) { // error = true; // e.printStackTrace(); // } finally { // if (ftp.isConnected()) { // try { // ftp.disconnect(); // } catch (IOException f) { // // do nothing // } // } // } } // end main public String getServer() { return server; } public void setServer(String server) { this.server = server; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public void diplayContent(FTPClient ftpClient, String path) throws IOException { System.out.println(path); for (FTPFile ftpFile : ftpClient.listFiles(path)) { if(ftpFile.isDirectory() ){ diplayContent(ftpClient, path+"/"+ftpFile.getName()); } else{ System.out.println(path+"/"+ftpFile.getName()); System.out.println(ftpFile.getTimestamp()); } } } } {code} The LIST command which is used internally in the FTPClient retrieves the timestamps successfully. However after parsing the FTPFile has a null value for the timestamp field. The null value is returned just when a user place the file in the AS400 usint the NetServer Servivice. This is used to share foldes between windows network and the AS/400 Please help us fix this problem. It is not critical to us. was: We are trying to list files from AS400 systems and retrieve the timestamps from these files using the following code: import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.net.InetAddress; import java.net.UnknownHostException; import org.apache.commons.net.PrintCommandListener; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPHTTPClient; import org.apache.commons.net.ftp.FTPClientConfig; import org.apache.commons.net.ftp.FTPConnectionClosedException; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPReply; import org.apache.commons.net.ftp.FTPSClient; import org.apache.commons.net.io.CopyStreamEvent; import org.apache.commons.net.io.CopyStreamListener; import org.apache.commons.net.util.TrustManagerUtils; public final class FTPAccess { private String server; private String username; private String password; private String path ; public String getPath() { return path; } public void setPath(String path) { this.path = path; } public static void main(String[] args) throws UnknownHostException { FTPAccess ftpAccess = new FTPAccess(); ftpAccess.setServer("X.X.X.X"); ftpAccess.setUsername("XXXXXX"); ftpAccess.setPassword(XXXXXXX"); ftpAccess.setPath("/reports"); ftpAccess.getFile(); } public void getFile() throws UnknownHostException { FTPClient ftpClient = new FTPClient(); try { InetAddress serveIPAddress = InetAddress.getByName(server); ftpClient.setPassiveLocalIPAddress(serveIPAddress); ftpClient.connect(serveIPAddress); System.out.println("Connected to " + server + "."); int reply = ftpClient.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { System.err.println("FTP server refused connection."); System.err.println(ftpClient.getReplyString()); ftpClient.disconnect(); } else { } if (!ftpClient.login(username, password)) { System.out.println(ftpClient.getReplyString()); ftpClient.logout(); } else{ diplayContent(ftpClient, path); } } catch (IOException e) { if (ftpClient.isConnected()) { try { ftpClient.disconnect(); } catch (IOException ioException) { // do nothing } } System.err.println("Could not connect to server."); // e.printStackTrace(); System.exit(1); } // } catch (FTPConnectionClosedException e) { // error = true; // System.err.println("Server closed connection."); // e.printStackTrace(); // } catch (IOException e) { // error = true; // e.printStackTrace(); // } finally { // if (ftp.isConnected()) { // try { // ftp.disconnect(); // } catch (IOException f) { // // do nothing // } // } // } } // end main public String getServer() { return server; } public void setServer(String server) { this.server = server; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public void diplayContent(FTPClient ftpClient, String path) throws IOException { System.out.println(path); for (FTPFile ftpFile : ftpClient.listFiles(path)) { if(ftpFile.isDirectory() ){ diplayContent(ftpClient, path+"/"+ftpFile.getName()); } else{ System.out.println(path+"/"+ftpFile.getName()); System.out.println(ftpFile.getTimestamp()); } } } } The LIST command which is used internally in the FTPClient retrieves the timestamps successfully. However after parsing the FTPFile has a null value for the timestamp field. The null value is returned just when a user place the file in the AS400 usint the NetServer Servivice. This is used to share foldes between windows network and the AS/400 Please help us fix this problem. It is not critical to us. > CLONE - Retrieving files from AS400 FTP systems returns null timestamps in FTPFile.getTimestamp > ----------------------------------------------------------------------------------------------- > > Key: NET-498 > URL: https://issues.apache.org/jira/browse/NET-498 > Project: Commons Net > Issue Type: Bug > Components: FTP > Affects Versions: 3.2 > Environment: Commons Net 3.2 > FTP System: AS400 systems > I5/OS Version 5 Release 4 Modification 0 > Reporter: Marco Slehiman > Priority: Minor > > We are trying to list files from AS400 systems and retrieve the timestamps from these files using the following code: > {code} > import java.io.FileInputStream; > import java.io.FileOutputStream; > import java.io.IOException; > import java.io.InputStream; > import java.io.OutputStream; > import java.io.PrintWriter; > import java.net.InetAddress; > import java.net.UnknownHostException; > import org.apache.commons.net.PrintCommandListener; > import org.apache.commons.net.ftp.FTP; > import org.apache.commons.net.ftp.FTPClient; > import org.apache.commons.net.ftp.FTPHTTPClient; > import org.apache.commons.net.ftp.FTPClientConfig; > import org.apache.commons.net.ftp.FTPConnectionClosedException; > import org.apache.commons.net.ftp.FTPFile; > import org.apache.commons.net.ftp.FTPReply; > import org.apache.commons.net.ftp.FTPSClient; > import org.apache.commons.net.io.CopyStreamEvent; > import org.apache.commons.net.io.CopyStreamListener; > import org.apache.commons.net.util.TrustManagerUtils; > public final class FTPAccess { > private String server; > private String username; > private String password; > private String path ; > public String getPath() { > return path; > } > public void setPath(String path) { > this.path = path; > } > public static void main(String[] args) throws UnknownHostException { > FTPAccess ftpAccess = new FTPAccess(); > ftpAccess.setServer("X.X.X.X"); > ftpAccess.setUsername("XXXXXX"); > ftpAccess.setPassword(XXXXXXX"); > ftpAccess.setPath("/reports"); > ftpAccess.getFile(); > } > public void getFile() throws UnknownHostException { > > FTPClient ftpClient = new FTPClient(); > > try { > InetAddress serveIPAddress = InetAddress.getByName(server); > ftpClient.setPassiveLocalIPAddress(serveIPAddress); > ftpClient.connect(serveIPAddress); > System.out.println("Connected to " + server + "."); > int reply = ftpClient.getReplyCode(); > if (!FTPReply.isPositiveCompletion(reply)) { > System.err.println("FTP server refused connection."); > System.err.println(ftpClient.getReplyString()); > ftpClient.disconnect(); > } else { > } > if (!ftpClient.login(username, password)) { > System.out.println(ftpClient.getReplyString()); > ftpClient.logout(); > } else{ > diplayContent(ftpClient, path); > } > } catch (IOException e) { > if (ftpClient.isConnected()) { > try { > ftpClient.disconnect(); > } catch (IOException ioException) { > // do nothing > } > } > System.err.println("Could not connect to server."); > // e.printStackTrace(); > System.exit(1); > } > // } catch (FTPConnectionClosedException e) { > // error = true; > // System.err.println("Server closed connection."); > // e.printStackTrace(); > // } catch (IOException e) { > // error = true; > // e.printStackTrace(); > // } finally { > // if (ftp.isConnected()) { > // try { > // ftp.disconnect(); > // } catch (IOException f) { > // // do nothing > // } > // } > // } > } // end main > public String getServer() { > return server; > } > public void setServer(String server) { > this.server = server; > } > public String getUsername() { > return username; > } > public void setUsername(String username) { > this.username = username; > } > public String getPassword() { > return password; > } > public void setPassword(String password) { > this.password = password; > } > > public void diplayContent(FTPClient ftpClient, String path) throws IOException { > System.out.println(path); > for (FTPFile ftpFile : ftpClient.listFiles(path)) { > if(ftpFile.isDirectory() ){ > diplayContent(ftpClient, path+"/"+ftpFile.getName()); > } else{ > System.out.println(path+"/"+ftpFile.getName()); > System.out.println(ftpFile.getTimestamp()); > } > } > > } > } > {code} > The LIST command which is used internally in the FTPClient retrieves the timestamps successfully. However after parsing the FTPFile has a null value for the timestamp field. > The null value is returned just when a user place the file in the AS400 usint the NetServer Servivice. This is used to share foldes between windows network and the AS/400 > Please help us fix this problem. It is not critical to us. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira