[jira] [Commented] (LANG-1328) FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt

2017-05-05 Thread Bruno P. Kinoshita (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15999233#comment-15999233
 ] 

Bruno P. Kinoshita commented on LANG-1328:
--

Hello,

Downloaded Android Studio (latest version), added Commons Lang 3.5 via Gradle, 
added your code minus the Android specific line, and then put a breakpoint to 
see what's happening.

In my case, I'm getting for pt_PT domingo for the EEE mask. Same code in Oracle 
JVM gives me dom for EEE. I'm guessing the extra R that appears for you is a 
typo? Or are you really seeing Dor and Dormingo? Dormingo does not exist in 
Portuguese (except as a slang, recently created).

Debugging, I could see that my Oracle JDK was using a ResourceBundle to load 
the Locale specific strings, while in Android, it was using ICU (import 
libcore.icu.LocaleData). Attaching some images from my IDE's with breakpoints 
around where I think the code differs.

I tried reproducing the issue with Oracle JDK + ICU here 
https://github.com/kinow/commons-sandbox/blob/master/src/main/java/br/eti/kinoshita/commons/LangDateTests.java,
 but I still get Dom for Oracle JDK, and dom with IBM ICU4J (tried recent 
versions, and the oldest I tried was 4.0.1).

I wonder if the following excerpt from Google's libcore helps:

{quote}
From: 
https://android.googlesource.com/platform/libcore/+/5d930ca/luni/src/main/java/java/util/Locale.java

 * 
Note that locale data is not necessarily available for any of the locales 
pre-defined as
 * constants in this class except for en_US, which is the only locale Java 
guarantees is always
 * available.
 *
 * It is also a mistake to assume that all devices have the same locales 
available.
 * A device sold in the US will almost certainly support en_US and es_US, but 
not necessarily
 * any locales with the same language but different countries (such as en_GB or 
es_ES),
 * nor any locales for other languages (such as de_DE). The opposite may well 
be true for a device
 * sold in Europe.

Versions of ICU:

 * Here are the versions of ICU (and the corresponding CLDR and Unicode 
versions) used in
 * various Android releases:
 * 
 * Android 1.5 (Cupcake)/Android 1.6 (Donut)/Android 2.0 (Eclair)
 * ICU 3.8
 * http://cldr.unicode.org/index/downloads/cldr-1-5;>CLDR 
1.5
 * http://www.unicode.org/versions/Unicode5.0.0/;>Unicode 
5.0
 * Android 2.2 (Froyo)
 * ICU 4.2
 * http://cldr.unicode.org/index/downloads/cldr-1-7;>CLDR 
1.7
 * http://www.unicode.org/versions/Unicode5.1.0/;>Unicode 
5.1
 * Android 2.3 (Gingerbread)/Android 3.0 (Honeycomb)
 * ICU 4.4
 * http://cldr.unicode.org/index/downloads/cldr-1-8;>CLDR 
1.8
 * http://www.unicode.org/versions/Unicode5.2.0/;>Unicode 
5.2
 * Android 4.0 (Ice Cream Sandwich)
 * http://site.icu-project.org/download/46;>ICU 4.6
 * http://cldr.unicode.org/index/downloads/cldr-1-9;>CLDR 
1.9
 * http://www.unicode.org/versions/Unicode6.0.0/;>Unicode 
6.0
 * Android 4.1 (Jelly Bean)
 * http://site.icu-project.org/download/48;>ICU 4.8
 * http://cldr.unicode.org/index/downloads/cldr-2-0;>CLDR 
2.0
 * http://www.unicode.org/versions/Unicode6.0.0/;>Unicode 
6.0
 * Android 4.3 (Jelly Bean MR2)
 * http://site.icu-project.org/download/50;>ICU 50
 * http://cldr.unicode.org/index/downloads/cldr-22-1;>CLDR 
22.1
 * http://www.unicode.org/versions/Unicode6.2.0/;>Unicode 
6.2
 * Android 4.4 (KitKat)
 * http://site.icu-project.org/download/51;>ICU 51
 * http://cldr.unicode.org/index/downloads/cldr-23;>CLDR 
23
 * http://www.unicode.org/versions/Unicode6.2.0/;>Unicode 
6.2
 * Android 4.? (STOPSHIP)
 * http://site.icu-project.org/download/53;>ICU 53
 * http://cldr.unicode.org/index/downloads/cldr-25;>CLDR 
25
 * http://www.unicode.org/versions/Unicode6.3.0/;>Unicode 
6.3
 * 
{quote}

Before trying anything, it would be helpful to have some code 
[~par.nils.am...@gmail.com]. Code that can be imported into an IDE, as well as 
detailed instructions to reproduce the issue. Then someone would need to dig a 
bit deeper than I did, and understand why the differences for the abbreviated 
week day name.

I don't see what could be done in [lang], and believe we will be able to find 
something missing in Android/libcore/icu for pt_PT, and then users will simply 
need to update their dependencies, without any change here in [lang].

> FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt
> ---
>
> Key: LANG-1328
> URL: https://issues.apache.org/jira/browse/LANG-1328
> Project: Commons Lang
>  Issue Type: Bug
>Affects Versions: 3.3.2
> Environment: Android
>Reporter: Pär Nils Amsen
> Attachments: android.png, oracle.png
>
>
> For the following statement:
> {code:java}
> FastDateFormat.getInstance("MMM", 

[jira] [Commented] (LANG-1328) FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt

2017-05-04 Thread JIRA

[ 
https://issues.apache.org/jira/browse/LANG-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15996787#comment-15996787
 ] 

Pär Nils Amsen commented on LANG-1328:
--

[~kinow] Yes I suspect that it is _device specific_ aswell, the 
abbreviations/weekdays are provided by the system right? My teammate tested on 
a couple of different devices:

*Samsung S3:*
PT_br: OK (Dor)
PT_pt: OK (Dor)

*Google Pixel:*
PT_br: OK (Dor)
PT_pt: NOK (Dormingo)

*Generic Android emulator*
PT_br: OK (Dor)
PT_pt: NOK (Dormingo)

Seems like the localization is provided by the device manufacturer or smth.

> FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt
> ---
>
> Key: LANG-1328
> URL: https://issues.apache.org/jira/browse/LANG-1328
> Project: Commons Lang
>  Issue Type: Bug
>Affects Versions: 3.3.2
> Environment: Android
>Reporter: Pär Nils Amsen
>
> For the following statement:
> {code:java}
> FastDateFormat.getInstance("MMM", timeZone, new Locale("pt", 
> "pt")).format(1494115200);
> {code}
> The outcome will be "dormingo" instead of "dor" in Portugese (pt_PT). I 
> expect this to be a bug since the only reason for FastDateFormat to not 
> abbreviate the weekdays would be that Portugese does not allow it, not very 
> likely.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (LANG-1328) FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt

2017-05-04 Thread Bruno P. Kinoshita (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15996598#comment-15996598
 ] 

Bruno P. Kinoshita commented on LANG-1328:
--

I still get Dom. Will re-open the issue, as I suspect this could be caused by 
some difference in Android JVM implementation.

> FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt
> ---
>
> Key: LANG-1328
> URL: https://issues.apache.org/jira/browse/LANG-1328
> Project: Commons Lang
>  Issue Type: Bug
>Affects Versions: 3.3.2
> Environment: Android
>Reporter: Pär Nils Amsen
>
> For the following statement:
> {code:java}
> FastDateFormat.getInstance("MMM", timeZone, new Locale("pt", 
> "pt")).format(1494115200);
> {code}
> The outcome will be "dormingo" instead of "dor" in Portugese (pt_PT). I 
> expect this to be a bug since the only reason for FastDateFormat to not 
> abbreviate the weekdays would be that Portugese does not allow it, not very 
> likely.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (LANG-1328) FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt

2017-05-04 Thread JIRA

[ 
https://issues.apache.org/jira/browse/LANG-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15996594#comment-15996594
 ] 

Pär Nils Amsen commented on LANG-1328:
--

[~kinow] I'm able to reproduce it in a fresh project! Here's a simple repo 
demonstrating the issue on 
[Github|https://github.com/paramsen/fastdateformatissue] (Android). In 
[MainActivity#18|https://github.com/paramsen/fastdateformatissue/blob/master/app/src/main/java/com/paramsen/fastdateformatissue/MainActivity.java#L18]
 the formatting happens, which produces "Dormido" instead of "Dor" on Android. 

Could it be that the FastDateFormat uses some built in stuff from the Android 
platform/shipped Java source to do the formatting?

> FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt
> ---
>
> Key: LANG-1328
> URL: https://issues.apache.org/jira/browse/LANG-1328
> Project: Commons Lang
>  Issue Type: Bug
>Affects Versions: 3.3.2
> Environment: Android
>Reporter: Pär Nils Amsen
>
> For the following statement:
> {code:java}
> FastDateFormat.getInstance("MMM", timeZone, new Locale("pt", 
> "pt")).format(1494115200);
> {code}
> The outcome will be "dormingo" instead of "dor" in Portugese (pt_PT). I 
> expect this to be a bug since the only reason for FastDateFormat to not 
> abbreviate the weekdays would be that Portugese does not allow it, not very 
> likely.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (LANG-1328) FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt

2017-05-04 Thread Bruno P. Kinoshita (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15996562#comment-15996562
 ] 

Bruno P. Kinoshita commented on LANG-1328:
--

Sure [~par.nils.am...@gmail.com], happy to re-open if we identify a 
bug/improvement with your new test.

> FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt
> ---
>
> Key: LANG-1328
> URL: https://issues.apache.org/jira/browse/LANG-1328
> Project: Commons Lang
>  Issue Type: Bug
>Affects Versions: 3.3.2
> Environment: Android
>Reporter: Pär Nils Amsen
>
> For the following statement:
> {code:java}
> FastDateFormat.getInstance("MMM", timeZone, new Locale("pt", 
> "pt")).format(1494115200);
> {code}
> The outcome will be "dormingo" instead of "dor" in Portugese (pt_PT). I 
> expect this to be a bug since the only reason for FastDateFormat to not 
> abbreviate the weekdays would be that Portugese does not allow it, not very 
> likely.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (LANG-1328) FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt

2017-05-04 Thread JIRA

[ 
https://issues.apache.org/jira/browse/LANG-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15996558#comment-15996558
 ] 

Pär Nils Amsen commented on LANG-1328:
--

Thanks for your superfast and thorough reply [~kinow]! Give me a minute and I 
will make a test in another context than the production code I'm working on, 
I'll close this if it works.

> FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt
> ---
>
> Key: LANG-1328
> URL: https://issues.apache.org/jira/browse/LANG-1328
> Project: Commons Lang
>  Issue Type: Bug
>Affects Versions: 3.3.2
> Environment: Android
>Reporter: Pär Nils Amsen
>
> For the following statement:
> {code:java}
> FastDateFormat.getInstance("MMM", timeZone, new Locale("pt", 
> "pt")).format(1494115200);
> {code}
> The outcome will be "dormingo" instead of "dor" in Portugese (pt_PT). I 
> expect this to be a bug since the only reason for FastDateFormat to not 
> abbreviate the weekdays would be that Portugese does not allow it, not very 
> likely.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (LANG-1328) FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt

2017-05-04 Thread Bruno P. Kinoshita (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15996553#comment-15996553
 ] 

Bruno P. Kinoshita commented on LANG-1328:
--

Hello  [~par.nils.am...@gmail.com],

>The outcome will be "dormingo" instead of "dor" in Portugese (pt_PT)

Actually, with 3.3.2 or 3.5, I'm getting the following from using pretty much 
your code.

{code}
String s = FastDateFormat.getInstance("MMM", TimeZone.getDefault(), new 
Locale("pt", "pt")).format(1494115200);
System.out.println(s);
{code}

Gives me:

{noformat}
jan
{noformat}

As M is the month of the year, and MMM is the three letter abbreviation for it. 
In Portuguese, MMM -> jan is correct (janeiro abbreviated as jan).

Using EEE, with either 3.5 or 3.3.2:

{code}
String s = FastDateFormat.getInstance("EEE", TimeZone.getDefault(), new 
Locale("pt", "pt")).format(1494115200);
System.out.println(s);
{code}

Gives me:

{noformat}
Dom
{noformat}

Which is again correct, as Domingo gets correctly abbreviated as Dom.

> FastDateFormat does not support 'EEE' and 'MMM' abbreviations for PT_pt
> ---
>
> Key: LANG-1328
> URL: https://issues.apache.org/jira/browse/LANG-1328
> Project: Commons Lang
>  Issue Type: Bug
>Affects Versions: 3.3.2
> Environment: Android
>Reporter: Pär Nils Amsen
>
> For the following statement:
> {code:java}
> FastDateFormat.getInstance("MMM", timeZone, new Locale("pt", 
> "pt")).format(1494115200);
> {code}
> The outcome will be "dormingo" instead of "dor" in Portugese (pt_PT). I 
> expect this to be a bug since the only reason for FastDateFormat to not 
> abbreviate the weekdays would be that Portugese does not allow it, not very 
> likely.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)