[ checkstyle-Bugs-594469 ] Tests fail with locale de_DE

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[ checkstyle-Bugs-594469 ] Tests fail with locale de_DE

SourceForge.net
Bugs item #594469, was opened at 2002-08-13 00:57
Message generated for change (Settings changed) made by oburn
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397078&aid=594469&group_id=29721

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tests
Group: release 2.4
>Status: Open
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Tilman Giese (b4market)
Assigned to: Oliver Burn (oburn)
Summary: Tests fail with locale de_DE

Initial Comment:
The following tests fail when using de_DE as locale:
LocalizedMessageTest and CheckerTest
I included the test reports. Tilman

----------------------------------------------------------------------

Comment By: Keita Kita (mikanbako)
Date: 2012-03-14 08:54

Message:
This bug returns at release5_5.

You can reproduce this problem in the following.

mvn -DargLine="-Duser.language=de -Duser.country=DE" test

----------------------------------------------------------------------

Comment By: Oliver Burn (oburn)
Date: 2002-08-28 16:51

Message:
Logged In: YES
user_id=218824

nice one.

----------------------------------------------------------------------

Comment By: Lars Kühne (lkuehne)
Date: 2002-08-28 15:04

Message:
Logged In: YES
user_id=401384

Fixed.

The problem is the search algorithm in
ResourceBundle.getBundle(). If the default locale is german
and we request english messages, then getBundle will try to
load messages_en.properties, that fails, and getBundle tries
the default locale (messages_de.properties). That succeeds
and our tests fail.

I added code to the compile.checkstyle target in build.xml
file that copies messages.properties to
messages_en.properties. This fixes the bug and users in
unsupported locales still see english error messages because
messages.properties is still available.

Another option I considered was to call
Locale.setDefault(Locale.ENGLISH) somewhere, but I suspect
that this will not behave well when checkstyle is embedded
in localized IDEs.

Maybe some Ant expert can copy the file in less than 4 lines
of XML code :-(


----------------------------------------------------------------------

Comment By: Tilman Giese (b4market)
Date: 2002-08-19 07:09

Message:
Logged In: YES
user_id=330781

I copied messages.properties to messages_en.properties and
now the tests succeed. But is this the solution we are
searching for?

----------------------------------------------------------------------

Comment By: Lars Kühne (lkuehne)
Date: 2002-08-18 08:07

Message:
Logged In: YES
user_id=401384

Yes, that helps, I'll have a look at it


----------------------------------------------------------------------

Comment By: Tilman Giese (b4market)
Date: 2002-08-15 01:47

Message:
Logged In: YES
user_id=330781

Perhaps you can reproduce this problem by setting the German
locale:

# export LANG="de_DE"
# ant run.tests

----------------------------------------------------------------------

Comment By: Tilman Giese (b4market)
Date: 2002-08-15 01:05

Message:
Logged In: YES
user_id=330781

I used the following code in LocalizedMessage.getMessage():

System.out.println("Current locale: " + sLocale);
final ResourceBundle bundle =
ResourceBundle.getBundle(MESSAGE_BUNDLE, sLocale);
final String pattern = bundle.getString(mKey);
System.out.println("Message: " + pattern);

And I get:

Current locale: en
Message: Pr�fung beendet.

So, the locale is set correctly, but the wrong resource
bundle is returned.

----------------------------------------------------------------------

Comment By: Oliver Burn (oburn)
Date: 2002-08-15 00:49

Message:
Logged In: YES
user_id=218824

re-opened as the bug as not been fixed.

Is the sentence "The locale is en as we set it in
LocalizedMessageTest.setUp()." correct??

This implies that the change of Locale did not take effect??



----------------------------------------------------------------------

Comment By: Tilman Giese (b4market)
Date: 2002-08-15 00:32

Message:
Logged In: YES
user_id=330781

Unfortunately, it does not work. But I do not understand
why. I used some System.out.println to show what happens is
LocalizedMessage.java. The locale is en as we set it in
LocalizedMessageTest.setUp(). But the pattern is in German
(yes, you read correctly). I can't believe it, but I don't
know where the problem could be. Tilman

----------------------------------------------------------------------

Comment By: Oliver Burn (oburn)
Date: 2002-08-13 19:02

Message:
Logged In: YES
user_id=218824

thanks - I have fixed the problem by forcing the Locale to be
english. Please confirm that the tests now run.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397078&aid=594469&group_id=29721


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2

_______________________________________________
Checkstyle-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-devel
Loading...