ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 54299] New: more efficient (and shorter) method calls in FTP.makeRemoteDir
Date Fri, 14 Dec 2012 20:41:42 GMT

            Bug ID: 54299
           Summary: more efficient (and shorter) method calls in
           Product: Ant
           Version: 1.8.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
    Classification: Unclassified

Created attachment 29759

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 "FTP.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

You are receiving this mail because:
You are the assignee for the bug.

View raw message