Return-Path: X-Original-To: apmail-ant-notifications-archive@minotaur.apache.org Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5D5E6D940 for ; Fri, 14 Dec 2012 21:04:08 +0000 (UTC) Received: (qmail 82733 invoked by uid 500); 14 Dec 2012 21:04:08 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 82709 invoked by uid 500); 14 Dec 2012 21:04:08 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 82702 invoked by uid 99); 14 Dec 2012 21:04:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2012 21:04:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.115] (HELO eir.zones.apache.org) (140.211.11.115) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2012 21:04:02 +0000 Received: by eir.zones.apache.org (Postfix, from userid 80) id 3869B4E7A; Fri, 14 Dec 2012 21:03:41 +0000 (UTC) From: bugzilla@apache.org To: notifications@ant.apache.org Subject: [Bug 54301] New: more efficient (and shorter) method call in FTP.FTPDirectoryScanner.AntFTPFile.getFastRelativePath Date: Fri, 14 Dec 2012 21:03:40 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ant X-Bugzilla-Component: Core X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nistor1@illinois.edu X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: notifications@ant.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter classification Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/bugzilla/show_bug.cgi?id=54301 Bug ID: 54301 Summary: more efficient (and shorter) method call in FTP.FTPDirectoryScanner.AntFTPFile.getFastRelativePath Product: Ant Version: 1.8.4 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P2 Component: Core Assignee: notifications@ant.apache.org Reporter: nistor1@illinois.edu Classification: Unclassified Created attachment 29762 --> https://issues.apache.org/bugzilla/attachment.cgi?id=29762&action=edit patch The problem appears in version 1.8.4 and in revision 1421898. I attached a one-line patch that fixes it. In method "FTP.FTPDirectoryScanner.AntFTPFile.getFastRelativePath", the call "absPath.indexOf(rootPath + remoteFileSep) == 0" should be "absPath.startsWith(rootPath + remoteFileSep)". The intent of the call is more explicit with "startsWith" than with "indexOf(..) == 0". "startsWith" is also more efficient than "indexOf", because "startsWith" tries to match only the start of the string, while "indexOf" searches until the first occurrence. There are many calls to "String.startsWith" in Ant (just like in the proposed patch), for example, in methods "AntlibDefinition.setURI", "AntClassLoader.isParentFirst", "ComponentHelper.checkNamespace", "Execute.getVMSLogicals", "ExecTask.isPath", "Jar.writeIndexLikeList", "Definer.makeResourceFromURI", "PathTokenizer.nextToken", etc. -- You are receiving this mail because: You are the assignee for the bug.