Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
In at least one place I know of in Hadoop, SimpleDateFormatter is used to serialize Date object in a format intended for machine consumption – and should be following strict formatting rules – but the SimpleDateFormatter instance is not constructed with an explicit Locale so the platform default is used instead. This causes things like "Day name in week" (E) to generate unexpected results depending on the Locale of the machine where the code is running, resulting in date-time strings that violate the formatting rules.
A specific example of this is AuthenticationFilter.createAuthCookie which has code that looks like this...
Date date = new Date(expires); SimpleDateFormat df = new SimpleDateFormat("EEE, " + "dd-MMM-yyyy HH:mm:ss zzz"); df.setTimeZone(TimeZone.getTimeZone("GMT")); sb.append("; Expires=").append(df.format(date));
...which can cause invalid expiration attributes in the Set-Cookies header like this (as noted by http-commons's ResponseProcessCookies class...
WARN: Invalid cookie header: "Set-Cookie: hadoop.auth=; Path=/; Domain=127.0.0.1; Expires=Ara, 01-Sa-1970 00:00:00 GMT; HttpOnly". Invalid 'expires' attribute: Ara, 01-Sa-1970 00:00:00 GMT
There are very likely many other places in the hadoop code base where the default Locale is being unintentionally used when formatting Dates/Numbers.
Attachments
Issue Links
- is related to
-
HADOOP-15681 AuthenticationFilter should generate valid date format for Set-Cookie header regardless of default Locale
- Resolved