DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29772>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=29772
DateLocaleConverter does NOT return a default value if a conversion error occurs
------- Additional Comments From niallp@apache.org 2004-07-08 11:12 -------
I've found a problem related to JDK 1.4 while trying to develop a Unit Test for
DateLocaleConverter to see whether I experience the kind of problem you were
describing.
It seems that SimpleDateFormat with a constructor of a localized pattern and
Locale doesn't work - it throws an IllegalArgumentException. This happened in
all versions of JDK 1.4 I tried (1.4.0_01, 1.4.2_01 and 1.4.2_05) including the
latest. However using JDK 1.3.1_04 everything worked fine.
The problem code is in the getFormatter(pattern, locale) method with the
following code:
SimpleDateFormat format = new SimpleDateFormat(pattern, locale);
The problem can be re-created if the default locale is Locale.US and this
method is called with a pattern of "t MMMM uuuu" and a locale of Locale.GERMAN,
then the following exception is generated:
java.lang.IllegalArgumentException: Illegal pattern character 't'
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:675)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:494)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:443)
You don't actually see this exception as the convert() method "swallows" it and
returns the "default" value.
I am still looking to see if I can find a work around, but haven't so far. I
checked Sun's bug database but couldn't see anything that resembled it, so I
have posted this as a bug there. The automated response to that bug said:
"Your report has been assigned an internal review ID of: 285201. This review ID
is NOT visible on the "Java Developer Connection" (JDC). We currently have a
three week response time for responding to Bug Reports."
Anyway, I'm not sure if this is the same issue as this bug or a different one.
Niall
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
|