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 4EB289336 for ; Thu, 1 Mar 2012 22:06:20 +0000 (UTC) Received: (qmail 69581 invoked by uid 500); 1 Mar 2012 22:06:19 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 69506 invoked by uid 500); 1 Mar 2012 22:06:19 -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 69497 invoked by uid 99); 1 Mar 2012 22:06:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2012 22:06:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2012 22:06:18 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id AA2BE3A1C for ; Thu, 1 Mar 2012 22:05:58 +0000 (UTC) Date: Thu, 1 Mar 2012 22:05:58 +0000 (UTC) From: "Andrea Selva (Commented) (JIRA)" To: issues@commons.apache.org Message-ID: <163754440.9125.1330639558698.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <187032806.39534.1329293399514.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (NET-442) StringIndexOutOfBoundsException: String index out of range: -1 if server respond with root is current directory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/NET-442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13220415#comment-13220415 ] Andrea Selva commented on NET-442: ---------------------------------- The FTP server I use, is an embedded custom server, that has got many many problems to be defined FTP compliant. But I think that FTP client should gracefully say that a message is not well formatted instead of a bad IndexOutOfBounds, but I completely agree that the FTP server that raised up this behaviour is completely broken. The issue could be closed as not applicable. Andrea > StringIndexOutOfBoundsException: String index out of range: -1 if server respond with root is current directory > --------------------------------------------------------------------------------------------------------------- > > Key: NET-442 > URL: https://issues.apache.org/jira/browse/NET-442 > Project: Commons Net > Issue Type: Bug > Components: FTP > Affects Versions: 3.0.1 > Environment: Ubuntu linux 11.04 > Reporter: Andrea Selva > > I've an ftp server that at the pwd request responds with |257 root is current directory.| without any double quotes present and the lib gives up with this exception: > java.lang.StringIndexOutOfBoundsException: String index out of range: -1 > at java.lang.String.substring(String.java:1949) > at org.apache.commons.net.ftp.FTPClient.__parsePathname(FTPClient.java:469) > at org.apache.commons.net.ftp.FTPClient.printWorkingDirectory(FTPClient.java:2374) > Probably it's only needed a check in __parsePathname > private String __parsePathname(String reply) > { > int begin, end; > begin = reply.indexOf('"') + 1; > end = reply.indexOf('"', begin); > > if (begin == -1 && end == -1) > { > return reply; > } > return reply.substring(begin, end); > } -- 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