ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: svn commit: r910955 [1/2] - in /ant/core/trunk/src/main/org/apache/tools: ant/ ant/helper/ ant/launch/ ant/taskdefs/ ant/taskdefs/compilers/ ant/taskdefs/condition/ ant/taskdefs/email/ ant/taskdefs/optional/ejb/ ant/taskdefs/optional/image/ ant/taskdef...
Date Thu, 18 Feb 2010 05:15:43 GMT
On 2010-02-17, Jesse Glick <Jesse.Glick@Sun.COM> wrote:

> bodewig@apache.org wrote:
>> if user input is compared to fixed strings in a case insensitive manner we should
use the default locale.  Use Locale.ENGLISH consistently

> Perhaps I'm not understanding the point of this.

>> URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Project.java?rev=910955&r1=910954&r2=910955&view=diff
>>      public static boolean toBoolean(String s) {
>> -        return ("on".equalsIgnoreCase(s)
>> -                || "true".equalsIgnoreCase(s)
>> -                || "yes".equalsIgnoreCase(s));
>>>        String lc = s == null ? null : s.toLowerCase(Locale.ENGLISH);
>>>        return ("on".equals(lc)
>>>                || "true".equals(lc)
>>>                || "yes".equals(lc));

> This should result in exactly the same behavior, except slower. So... why?

Because I misread the Javadocs, it seems.  And I didn't perform any
tests to back what I thought I read.  The point I didn't see was that
Character.toUpperCase is not Locale sensitive (which isn't spelled out
explicitly).

I'll revert most of the changes and transform the comparisions to
equalsIgnoreCase where appropriate.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message