ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 54305] New: more efficient method call in FileUtils.isContextRelativePath
Date Fri, 14 Dec 2012 23:35:07 GMT

            Bug ID: 54305
           Summary: more efficient method call in
           Product: Ant
           Version: 1.8.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
    Classification: Unclassified

Created attachment 29767

The problem appears in version 1.8.4 and in revision 1421898.  I
attached a one-line patch that fixes it.

In method "FileUtils.isContextRelativePath", the call
"filename.indexOf(':') == 1" should be "filename.charAt(1) == ':'"
(the first character is a letter as checked by "Character.isLetter(c)"
earlier in the boolean expression).  In the entire method, "charAt" is
already used 3 different times to check the values of characters 0, 1,
and 2 (while "indexOf" just once, in the instance described above).
These existing 3 calls to "charAt" make the string pattern being
checked for more explicit.  Also, "charAt" is more efficient than
"indexOf", because "charAt" reads only a single character at a given
position, while "indexOf" searches until the first occurrence.

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

View raw message