This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 159191 - I18N : localized messages will not picked up at 2nd execution
Summary: I18N : localized messages will not picked up at 2nd execution
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Module System (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: I18N
Depends on:
Blocks:
 
Reported: 2009-02-26 07:03 UTC by Masaki Katakai
Modified: 2009-03-11 12:19 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Result of 3rd invocation of: netbeans --userdir locwin --locale ja (39.09 KB, image/png)
2009-03-02 15:51 UTC, Jaroslav Tulach
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Masaki Katakai 2009-02-26 07:03:27 UTC
If NetBeans userdir is existing, which means we start NetBeans next time,
UI messages are back to English.

1. Install NetBeans
2. Remove userdir
3. Start NetBeans on localized environment
    UI messages are localized -> OK
4. Quit, and restart NetBeans
5. Messages on splash screen are localized, but UI of IDE are
    now English

This problem started from 200902201401 trunk ml build. I don't see this problem on
200902190601 ml build. M2 is OK.

200902190601: OK
trunk/daily/2009-02-19_06-01-04/ml/zip/netbeans-trunk-nightly-200902190601-ml-cpp.zip

200902201401: FAILED
trunk/daily/2009-02-20_02-01-11/ml/zip/netbeans-trunk-nightly-200902200201-ml-cpp.zip

It looks something has been updated in platform10/lib/boot.jar. When I use
200902190601's boot.jar in 200902201401 build and latest build, the problem
won't happen.
Comment 1 t_h 2009-02-26 15:47:33 UTC
Maybe ff93758eb7eb?
Comment 2 Jaroslav Tulach 2009-03-02 09:52:11 UTC
Looks like ff93758eb7eb.
Comment 3 Jaroslav Tulach 2009-03-02 15:46:10 UTC
Works for me with 
trunk/daily/2009-02-20_02-01-11/ml/zip/netbeans-trunk-nightly-200902200201-ml-cpp.zip
on my Linux. Everything is properly localized. First and second start.
Comment 4 Jaroslav Tulach 2009-03-02 15:49:22 UTC
Works on my windows too.
Comment 5 Jaroslav Tulach 2009-03-02 15:51:59 UTC
Created attachment 77566 [details]
Result of 3rd invocation of: netbeans --userdir locwin --locale ja
Comment 6 Masaki Katakai 2009-03-02 16:06:36 UTC
Thanks for trying.

Could you try again on Linux or Solaris without --locale option by switching the desktop locale to Japanese?
It seems that --locale option solves this issue.

It actually happens on my Japanese Windows, I'm not using --locale option.
Comment 7 Jaroslav Tulach 2009-03-02 18:46:11 UTC
How to switch locale on Linux? Which one am I supposed to change?

~$ set | grep LC_
LC_ADDRESS=cs_CZ.UTF-8
LC_COLLATE=cs_CZ.UTF-8
LC_CTYPE=cs_CZ.UTF-8
LC_IDENTIFICATION=cs_CZ.UTF-8
LC_MEASUREMENT=cs_CZ.UTF-8
LC_MESSAGES=cs_CZ.UTF-8
LC_MONETARY=cs_CZ.UTF-8
LC_NAME=cs_CZ.UTF-8
LC_NUMERIC=cs_CZ.UTF-8
LC_PAPER=cs_CZ.UTF-8
LC_SOURCED=1
LC_TELEPHONE=cs_CZ.UTF-8
LC_TIME=cs_CZ.UTF-8

Comment 8 Masaki Katakai 2009-03-03 01:48:18 UTC
Hi Jaroslav,

It can start in Japanese locale by changing LANG and LC_ALL.

% env LANG=ja_JP.UTF-8 LC_ALL=ja_JP.UTF-8 netbeas
Comment 9 Jaroslav Tulach 2009-03-03 10:44:21 UTC
Bad news. I tried on Linux, with no LC_* and 
export LANG=ja_JP.UTF-8; export LC_ALL=ja_JP.UTF-8; ./netbeans/bin/netbeans --userdir testuserdir
but the system starts in English locale. 

That is why I went to our Japanese Solaris and Logged into ja_JP.UTF-8 session. Everything worked. I also tried 
ja_JP.euc sesssion. That one worked OK as well. I am sorry, but without steps to reproduce there is nothing I can do 
to fix your problem. Please help us investigate what is wrong.

The wrong code has to be in o.n.bootstrap/src/org/netbeans/Util.java, see the static initializer block at lines 67-97 
(in revision 79fbbf2854f9). Probably the "map" variable will be filled with wrong content the second time the IDE 
starts. The question is why...

Comment 10 Masaki Katakai 2009-03-04 01:35:36 UTC
Thanks for the info. I'm debugging Util.java and found the problem (probably...)

It seems that these codes below are trying to load and set for localized file
defined as fws, but fws is never added to "arr". So empty "arr" is always
added to map (tmp).

                List<FileWithSuffix> arr = new ArrayList<FileWithSuffix>();
                for (;;) {
                    FileWithSuffix fws = FileWithSuffix.read(is);
                    if (fws == null) {
                        break;
                    }
                }
                tmp.put(new File(file), arr);

So I think it should be below, "arr.add(fws)" needs to be called.

                List<FileWithSuffix> arr = new ArrayList<FileWithSuffix>();
                for (;;) {
                    FileWithSuffix fws = FileWithSuffix.read(is);
                    if (fws == null) {
                        break;
                    }
+                   arr.add(fws)
                }
                tmp.put(new File(file), arr);

I rebuilt it with this change and tried on my OpenSolaris, it's working now,
the problem disappeared.

Jaroslav, could you review?
Comment 11 Masaki Katakai 2009-03-09 03:16:11 UTC
Hi Jaroslav, could you check the patch above?
Comment 12 Jaroslav Tulach 2009-03-09 12:32:03 UTC
Thanks a lot: ergonomics#3333b4ee5fb0

I am surprised the code could ever work. But it really did when I tried!
Comment 13 Quality Engineering 2009-03-10 09:25:17 UTC
Integrated into 'main-golden', will be available in build *200903100201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/3333b4ee5fb0
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #159191: masaki's fix to deserialization of suffix cache
Comment 14 Masaki Katakai 2009-03-11 03:22:24 UTC
Thank you Jaroslav!

It's now working. Verified on 200903101401.
Comment 15 Jaroslav Tulach 2009-03-11 12:19:03 UTC
Well, I've just integrated your patch. Thanks for it.