logo       

[xstream-dev] [jira] Closed: (XSTR-91) BasicTypesTest fails under japanese : msg#00025

java.xstream.devel

Subject: [xstream-dev] [jira] Closed: (XSTR-91) BasicTypesTest fails under japanese locale

Message:

The following issue has been closed.

---------------------------------------------------------------------
View the issue:
http://jira.codehaus.org/browse/XSTR-91

Here is an overview of the issue:
---------------------------------------------------------------------
Key: XSTR-91
Summary: BasicTypesTest fails under japanese locale
Type: Bug

Status: Closed
Priority: Major
Resolution: FIXED

Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown

Project: XStream
Components:
Converters
Fix Fors:
1.0.2

Assignee:
Reporter: Kouhei Mori

Created: Wed, 23 Jun 2004 6:41 PM
Updated: Sun, 25 Jul 2004 8:28 AM

Description:
Under japanese locale, com.thoughtworks.acceptance.BasicTypesTest fails as
follows:

[junit] Testcase: testDate(com.thoughtworks.acceptance.BasicTypesTest):
FAILED
[junit] expected:<...AM...> but was:<...¸áÁ°...>
[junit] junit.framework.ComparisonFailure: expected:<...AM...> but
was:<...¸áÁ°...>
[junit] at
com.thoughtworks.acceptance.AbstractAcceptanceTest.assertBothWays(Unknown
Source)
[junit] at com.thoughtworks.acceptance.BasicTypesTest.testDate(Unknown
Source)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[junit] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

"¸áÁ°" is a japanese word meaning "AM".
This is because, SimpleDateFormat did not always format 'a' pattern letter to
AM/PM.
Explicitly specifying english locale is a solution to this problem?

Index:
src/java/com/thoughtworks/xstream/converters/basic/ThreadSafeSimpleDateFormat.java
===================================================================
RCS file:
/scm/xstream/xstream/src/java/com/thoughtworks/xstream/converters/basic/ThreadSafeSimpleDateFormat.java,v
retrieving revision 1.5
diff -u -r1.5 ThreadSafeSimpleDateFormat.java
---
src/java/com/thoughtworks/xstream/converters/basic/ThreadSafeSimpleDateFormat.java
11 May 2004 17:21:42 -0000 1.5
+++
src/java/com/thoughtworks/xstream/converters/basic/ThreadSafeSimpleDateFormat.java
23 Jun 2004 22:38:10 -0000
@@ -4,6 +4,7 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.Locale;

/**
* Wrapper around java.text.SimpleDateFormat that can
@@ -84,7 +85,7 @@
}

private DateFormat createNew() {
- return new SimpleDateFormat(formatString);
+ return new SimpleDateFormat(formatString, Locale.ENGLISH);
}

}


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise