[
https://issues.apache.org/jira/browse/DIRAPI-219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14708212#comment-14708212
]
Uwe Schindler edited comment on DIRAPI-219 at 8/22/15 11:09 PM:
----------------------------------------------------------------
What does the Locale has to do how strings are encoded? The code changes
nothing it was fine before and after.
The problem is that your calendar is wrong. The above locales simply don't use
gregorian calendars.
My suggestion: Use SimpleDateFormat and pass Locale = Locale.ENGLISH, also use
a GregorianCalendar.
In addition, when parsing date times in this format, you also have to give the
correct Locale. E.g., Thai locales don#T use ASCII digits, so a date with ASCII
digits cannot be parsed by those calendars.
I would also suggest to use the forbidden-apis Maven/Ant module that checks for
all signatures in the JDK that rely on some external (unwanted) defaults like
charsets, locales or timezones:
https://github.com/policeman-tools/forbidden-apis
Lucene/Solr/Elasticsearch/Tika use that module. See also the blog post about it
why you should use it.
was (Author: thetaphi):
What does the Locale has to do how strings are encoded? The code changes
nothing it was fine before and after.
The problem is that your calendar is wrong. The above locales simply don't use
gregorian calendars.
My suggestion: Use SimpleDateFormat and pass Locale = Locale.ENGLISH, also use
a GregorianCalendar.
> DateUtils.toGeneralizedTime does not work with some Locales
> -----------------------------------------------------------
>
> Key: DIRAPI-219
> URL: https://issues.apache.org/jira/browse/DIRAPI-219
> Project: Directory Client API
> Issue Type: Bug
> Affects Versions: 1.0.0-M28
> Reporter: Gregory Chanan
> Fix For: 1.0.0-M29
>
>
> Over in SOLR-6915 I've run into an issue with a few Locales when trying to
> use Apache Directory Server via the Hadoop MiniKDC. Here's an example
> failure that happens on JDK8:
> https://issues.apache.org/jira/browse/SOLR-6915?focusedCommentId=14287516&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14287516
> The locales that have a problem for me are:
> th_TH_TH_#u-nu-thai
> ja_JP_JP_#u-ca-japanese
> hi_IN
> I've tracked these problems to DateUtils.toGeneralizedTime(), which is
> returning the following to me for these 3 locales, respectively:
> à¹à¹à¹à¹à¹à¹à¹à¹à¹à¹à¹à¹à¹à¹.à¹à¹à¹Z
> 270127010806.259Z
> २०१५०१२à¥à¥¦à¥§à¥¦à¥®à¥¦à¥¬.०४०Z
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)