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 3FA28D53F for ; Fri, 14 Dec 2012 20:08:21 +0000 (UTC) Received: (qmail 34155 invoked by uid 500); 14 Dec 2012 20:08:21 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 34122 invoked by uid 500); 14 Dec 2012 20:08:21 -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 34114 invoked by uid 99); 14 Dec 2012 20:08:20 -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 20:08:20 +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 20:08:18 +0000 Received: by eir.zones.apache.org (Postfix, from userid 80) id 83D674ACD; Fri, 14 Dec 2012 20:07:57 +0000 (UTC) From: bugzilla@apache.org To: notifications@ant.apache.org Subject: [Bug 54298] New: more efficient (and shorter) method calls in FTPTaskMirrorImpl.makeRemoteDir Date: Fri, 14 Dec 2012 20:07:56 +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=54298 Bug ID: 54298 Summary: more efficient (and shorter) method calls in FTPTaskMirrorImpl.makeRemoteDir 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 29757 --> https://issues.apache.org/bugzilla/attachment.cgi?id=29757&action=edit patch The problem appears in version 1.8.4 and in revision 1421898. I attached a one-line patch (firstCall.diff) that fixes it. In method "FTPTaskMirrorImpl.makeRemoteDir", there are two calls to "dir.indexOf("/") == 0". These calls should be "dir.startsWith("/")". 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. I attached a second one-line patch (secondCall.diff) for the second call. -- You are receiving this mail because: You are the assignee for the bug.