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 240650 - Incorrect automatic internationalization resource bundle property handling with 'Change Variable Name'.
Summary: Incorrect automatic internationalization resource bundle property handling wi...
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.4
Hardware: PC Other
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-18 23:23 UTC by schulte2004
Modified: 2014-02-07 02:38 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description schulte2004 2014-01-18 23:23:59 UTC
Product Version: NetBeans IDE 7.4 (Build 201310111528)
Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 2
Java: 1.7.0_45; OpenJDK 64-Bit Server VM 24.45-b08
Runtime: OpenJDK Runtime Environment 1.7.0_45-b18


As of Netbeans 7.4, renaming a component using 'Change Variable Name...' in the navigator, the form editor creates multiple redundant properties in the resource bundle properties file backing the form and does not remove old properties. After renaming some components, the properties files are garbled and need to be cleaned up manually.
Comment 1 schulte2004 2014-01-19 00:00:14 UTC
Product Version: NetBeans IDE 8.0 Beta (Build 201401141042)
Java: 1.7.0_45; OpenJDK 64-Bit Server VM 24.45-b08
Runtime: OpenJDK Runtime Environment 1.7.0_45-b18

Also happens with 8.0 Beta.
Comment 2 Tomas Pavek 2014-02-05 18:46:20 UTC
This is a race condition, does not happen always. When it happens then the renamed property appears twice (with the new key) in the properties file.

When a component (e.g. JLabel) is renamed in GUI builder then the original property in the properties file (e.g. defining the text) is removed and a new one is added with the new key. Then also the value is updated, which here is no change, but in other situations both the key and the value can be changed together.

So there are 3 changes done via the properties module API: remove item, add a new item, and modify the item. The problem is that after each change the properties module invokes an asynchronous update from the document (after it writes the change to document it updates the structure back from the changes detected on the document). Because these updates are asynchronously running in another thread they change the memory structures at random moments while we are still trying to make changes there.

In our specific situation what happens is that after we do the 2nd change (add item), the async update from the first change arrives and puts the state of the structures back, like if the item was not added. Then the 3rd change does not find the item and adds it again. It ends up there twice then. In case the async update arrives later and does not ruin the memory state in the middle then it works fine.

This is a bug (or design flaw) in the properties module (some transactions missing?), I've tried to workaround it:
http://hg.netbeans.org/jet-main/rev/2fda44febe8a
Comment 3 Quality Engineering 2014-02-07 02:38:48 UTC
Integrated into 'main-silver', will be available in build *201402070001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/2fda44febe8a
User: Tomas Pavek <tpavek@netbeans.org>
Log: #240650: can't do more than two subsequent changes in properties module because its async updates may revert the state back temporarily