[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] Small java.util.Locale change
From: |
Andrew John Hughes |
Subject: |
[cp-patches] Small java.util.Locale change |
Date: |
Mon, 20 Dec 2004 01:23:35 +0000 |
User-agent: |
Mutt/1.5.6+20040907i |
I spotted a small bug in java.util.Locale while trying to debug a problem in
java.util.Currency. The equals method compares String objects using ==
rather than equals().
As to the java.util.Currency problem, it appears that the method I was trying
to fix is broken semantically. getCurrency(Locale.UK) is not equal to
getCurrency("GBP"), because the return value of getCurrency("GBP") is
non-deterministic. Depending on the locales available, the one returned
can be any of several locales that use the Great British Pound. In our
case, it iterates through the getAvailableLocales() return value (which, thanks
to Michaels' recent changes, now works), and gets to cy_GB first (Wales).
The same is true far more clearly, with the Euro, which is used in at least
half the European countries. Sun's documentation makes no mention of how
the return value is supposed to be determined, and we have more locales than
them, so we can't really compare (and shouldn't anyway).
Changelog entry:
2004-12-19 Andrew John Hughes <address@hidden>
* java/util/Locale.java (equals): Fix comparison
to use equals() methods of String objects, rather
than referential equality (==).
--
Andrew :-)
Please avoid sending me Microsoft Office (e.g. Word, PowerPoint) attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
No software patents in Europe -- http://nosoftwarepatents.com
"Value your freedom, or you will lose it, teaches history.
`Don't bother us with politics' respond those who don't want to learn."
-- Richard Stallman
"We've all been part of the biggest beta test the world has ever known --
Windows"
-- Victor Wheatman, Gartner
locale-01.diff
Description: Text document
signature.asc
Description: Digital signature
- [cp-patches] Small java.util.Locale change,
Andrew John Hughes <=