Project: JDT
Bug 111972 [nls tooling] Duplicate keys created in Externalize Strings Wizard
Reported: 2005-10-07 14:54:23 | Status: resolved fixed

To reproduce: 1) Create your own Messages class without a BUNDLE_NAME constant. 2) Go to the class you want to externalize and run the externalization wizard. 3) Point the externalization wizard to your custom Messages class. 4) Finish the wizard. 5) Add some new strings to the class you externalized in step 2, and run the externalization wizard on the class again. 6) Although the wizard points the same messages.properties file and Messages class, the new strings will be assigned the same keys as the string externalized in step 2. Cause: The externalization wizard looks for the BUNDLE_NAME constant in the Messages class (the default Messages class has a private BUNDLE_NAME constant). If the constant doesn't exist, the wizard starts the keys from 0. If it does exist but doesn't point at the correct messages.properties file, the wizard will produce errors on any keys not in the BUNDLE_NAME constants messages.properties file (even if the wizard is pointed at the correct messages.properties file). Solution: The wizard should check the keys from the messages.properties file pointed to by the wizard, not by the messages.properties file pointed to by the BUNDLE_NAME constant in the Messages class.

Files changed in fix:
org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/nls/NLSHintHelper.java