Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 86C2A200C14 for ; Tue, 7 Feb 2017 16:41:47 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 8382D160B4B; Tue, 7 Feb 2017 15:41:47 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CDA6F160B3E for ; Tue, 7 Feb 2017 16:41:46 +0100 (CET) Received: (qmail 8283 invoked by uid 500); 7 Feb 2017 15:41:46 -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 8271 invoked by uid 99); 7 Feb 2017 15:41:46 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2017 15:41:45 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 75FE71A034C for ; Tue, 7 Feb 2017 15:41:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id yxqH2JAmULGS for ; Tue, 7 Feb 2017 15:41:43 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 01B465F254 for ; Tue, 7 Feb 2017 15:41:43 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 31F0DE026E for ; Tue, 7 Feb 2017 15:41:42 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id D7CDD2528C for ; Tue, 7 Feb 2017 15:41:41 +0000 (UTC) Date: Tue, 7 Feb 2017 15:41:41 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (NET-610) FTPClient.mlistFile incorrectly handles MLST reply MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 07 Feb 2017 15:41:47 -0000 [ https://issues.apache.org/jira/browse/NET-610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sebb resolved NET-610. ---------------------- Resolution: Fixed Fix Version/s: 3.6 Author: sebb Date: Tue Feb 7 15:33:35 2017 New Revision: 1782012 URL: http://svn.apache.org/viewvc?rev=1782012&view=rev Log: NET-610 FTPClient.mlistFile incorrectly handles MLST reply Modified: commons/proper/net/trunk/src/changes/changes.xml commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java > FTPClient.mlistFile incorrectly handles MLST reply > -------------------------------------------------- > > Key: NET-610 > URL: https://issues.apache.org/jira/browse/NET-610 > Project: Commons Net > Issue Type: Bug > Components: FTP > Affects Versions: 3.5 > Environment: using some FTP-server incorrectly releasing RFC 3659. For example xlight ftp server (https://www.xlightftpd.com/) > Reporter: Sergey Yanzin > Labels: easyfix, patch > Fix For: 3.6 > > Original Estimate: 24h > Remaining Estimate: 24h > > By RFC 3659 server must start fact with space character. But some inaccurate realisations reply without starting space. > But org.apache.commons.net.ftp.FTPClient.mlistFile() skips leading character even it is not a space: > public FTPFile mlistFile(String pathname) throws IOException > { > boolean success = FTPReply.isPositiveCompletion(sendCommand(FTPCmd.MLST, pathname)); > if (success){ > String entry = getReplyStrings()[1].substring(1); // skip leading space for parser > return MLSxEntryParser.parseEntry(entry); > } else { > return null; > } > } > I think it is wrong. The method should throw exception, if first character is not a space. Or does not remove starting char (and should be some option responsible for that behaviour) if it is not a space. > my workaround in overriden method: > public FTPFile mlistFile(String pathname) throws IOException { > final boolean success = FTPReply.isPositiveCompletion(sendCommand(FTPCmd.MLST, pathname)); > if (success) { > final String reply = getReplyStrings()[1]; > final String entry = reply.charAt(0) == ' ' ? reply.substring(1) : reply; > return MLSxEntryParser.parseEntry(entry); > } else { > return null; > } > } -- This message was sent by Atlassian JIRA (v6.3.15#6346)