https://issues.apache.org/bugzilla/show_bug.cgi?id=54303
Bug ID: 54303
Summary: more efficient (and shorter) method calls in
XmlPropertyTest.ensureProperties
Product: Ant
Version: 1.8.4
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Core
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
Created attachment 29764
--> https://issues.apache.org/bugzilla/attachment.cgi?id=29764&action=edit
firstCall.diff
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 "XmlPropertyTest.ensureProperties", the call
"propertyValue.indexOf("ID.") == 0" should be
"propertyValue.startsWith("ID.")". 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 is a similar second call to "propertyValue.indexOf("FILE.") == 0".
I attached a second patch (secondCall.diff) for it.
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.