Menu

#7 Locale in makeStandardHttpDateFormat

open
nobody
None
5
2005-12-22
2005-12-22
Espen W
No

Running fitnesse in a different locale than US
generates ParseException when accessing pages.

eg.

java.text.ParseException: Unparseable date: "Wed, 03
Aug 2005 18:20:18 GMT"
at java.text.DateFormat.parse(Unknown Source)
at
fitnesse.responders.files.FileResponder.isNotModified
..
....

Solution:

In class Response

add Locale.US

public static SimpleDateFormat
makeStandardHttpDateFormat()
{
//SimpleDateFormat is not thread safe, so we need
to create each instance independently.
SimpleDateFormat df = new SimpleDateFormat("EEE,
dd MMM yyyy HH:mm:ss z",Locale.US);
df.setTimeZone(TimeZone.getTimeZone("GMT"));
return df;
}

Discussion


Log in to post a comment.

MongoDB Logo MongoDB