Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356737

Summary: UnitFormatTest fails due to locale-specific unit symbol comparison
Product: [Technology] UOMo Reporter: Peter Melnikov <peter.melnikov>
Component: UnitsAssignee: Werner Keil <werner.keil>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
URL: http://kenai.com/jira/browse/JSR_275-43
Whiteboard:
Attachments:
Description Flags
UnitFormatTest surefire report none

Description Peter Melnikov CLA 2011-09-05 11:34:43 EDT
Build Identifier: built using maven 2, java version "1.6.0_26"

UnitFormatTest.toStringTest() fails because it tries to compare units symbols that are locale specific. In the test's source code it is 'm' for metre compared to a symbol from message resources. On machine with different locale settings (e.g. russian with cyrillic) it will be different and they will not match.


Reproducible: Always

Steps to Reproduce:
1. Setup russian locale
2. Run maven package
Comment 1 Peter Melnikov CLA 2011-09-05 11:35:56 EDT
Created attachment 202765 [details]
UnitFormatTest surefire report
Comment 2 Werner Keil CLA 2011-09-06 07:25:29 EDT
Peter,

Thanks a lot for sharing that. I placed a link to the original issue in the heritage from JSR-275 here, too.

This test is among those influenced by the Unit JSR proposal.
It should work equally well using the COMPARISON_LOCALE, I'll fix it as soon as I can. Should you have a patch, please feel free to attach it here
(it isn't too obvious, but this URL explains relatively well how to create at patch with Git: http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/)

P.s.:
The JSR also contained many translations, some of which are supposed to go into Eclipse Babel. The initial import may have lost them, but I'm hoping to add them for other languages than German, too. If you're interested and able, please use your Bugzilla ID to join Babel: http://babel.eclipse.org/ adding further Russian translations to UOMo and other projects.

Thanks, Werner
Comment 3 Werner Keil CLA 2011-09-10 11:24:40 EDT
Changed the method from toString() test to also use a UnitFormat. Since the test as such compares multiple operations, toString() isn't the only way to retrieve and compare those. Tests pass as before, should work regardless of the default locale.
Comment 4 Werner Keil CLA 2012-01-19 07:33:45 EST
Considering closed