Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350946 - [registry] Translations for Java Content Type labels not loaded in a fresh install
Summary: [registry] Translations for Java Content Type labels not loaded in a fresh in...
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Components (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: Juno M1   Edit
Assignee: equinox.components-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 351843
  Show dependency tree
 
Reported: 2011-07-01 10:55 EDT by Kit Lo CLA
Modified: 2011-07-12 09:59 EDT (History)
4 users (show)

See Also:
dj.houghton: review+


Attachments
Screen capture (33.80 KB, image/png)
2011-07-01 10:55 EDT, Kit Lo CLA
no flags Details
Stack trace - error in fragment resolution (4.34 KB, text/plain)
2011-07-11 12:15 EDT, Oleg Besedin CLA
no flags Details
possible fix (2.21 KB, patch)
2011-07-11 22:23 EDT, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kit Lo CLA 2011-07-01 10:55:34 EDT
Created attachment 198970 [details]
Screen capture

Build ID: I20110628-0800

Using some pseudo translations, we can see that some Java Content Type labels are unexternalized.
Comment 1 Markus Keller CLA 2011-07-01 11:51:11 EDT
Looks like the pseudo translation pack is missing /org.eclipse.jdt.core/plugin.properties .

When I add a /org.eclipse.jdt.core/plugin_DE.properties and then start with -nl DE, I see the modified strings.
Comment 2 Kit Lo CLA 2011-07-01 12:05:17 EDT
Markus, I don't see the string in my jar: org.eclipse.jdt.core_3.7.0.v_B61.jar. Is my build too old? Can you give me the key name so I can search for the string?
Comment 3 Markus Keller CLA 2011-07-01 12:15:27 EDT
Strange, I have these strings at the very end of 
I20110628-0800\plugins\org.eclipse.jdt.core_3.7.0.v_B61.jar\plugin.properties:

javaPropertiesName=Java Properties File
javaSourceName=Java Source File
javaClassName=Java Class File
jarManifestName=JAR Manifest File


They are referenced in the plugin.xml like this:

<extension point="org.eclipse.core.contenttype.contentTypes">
	<!-- declares a content type for Java Properties files -->
	<content-type id="javaProperties" name="%javaPropertiesName" 
		base-type="org.eclipse.core.runtime.text"
		priority="high"				
		file-extensions="properties"
		default-charset="ISO-8859-1"/>
	<!-- Associates .classpath to the XML content type -->
	<file-association 
		content-type="org.eclipse.core.runtime.xml" 
		file-names=".classpath"/>  
	<!-- declares a content type for Java Source files -->
	<content-type id="javaSource" name="%javaSourceName" 
		base-type="org.eclipse.core.runtime.text"
		priority="high"				
		file-extensions="java"/>
...

The last change in these strings was in 2005.
Comment 4 Kit Lo CLA 2011-07-01 12:19:33 EDT
Sorry about the previous comment. I got 2 bugs I just opened this morning mixed up :-). I see the strings in the jar now. I will investigate more. Thanks!
Comment 5 Kit Lo CLA 2011-07-01 12:53:57 EDT
Looks like it's a loading problem.

If I start with a fresh install of Eclipse and the language pack (for any language), and launch Eclipse in that language (for example, German), then the translations for Java Content Type labels are not loaded. Note that all other Content Type labels are displayed as translated.

If I switch to launch Eclipse in English one time, then launch Eclipse in German again, then the translations for Java Content Type labels are loaded.
Comment 6 Markus Keller CLA 2011-07-01 13:01:11 EDT
The org.eclipse.core.contenttype plug-in reads the content types.
Comment 7 DJ Houghton CLA 2011-07-06 10:53:32 EDT
Are there sample language packs that we can download to reproduce this problem? The ones on the Babel web site aren't for Indigo, but will they still show the issue?
Comment 8 DJ Houghton CLA 2011-07-07 13:36:11 EDT
I've been able to reproduce the problem locally and in single-user mode as well as in the shared install scenario. 

Oleg, does this issue sound familiar to you? I'm debugging it am in the extension registry code and it doesn't seem to be picking up the contribution on the first run. In this particular case there are 5 fragments to the host bundle (jdt.core) but I'm not sure if that is relavant.
Comment 9 Oleg Besedin CLA 2011-07-07 15:37:46 EDT
(In reply to comment #8)
> Oleg, does this issue sound familiar to you?

Nope. This might be a problem with bundle resolution timing or order.

As a debug point, for SDK the actual translation is done in the ResourceTranslator class from equinox.common.

The bundle processing requests are coming through EclipseBundleListener#addBundle(). The registry relies on bundle resolution process and I think some time ago there were changes with STARTING state. May be that's what causes the issue? (Or fragments not being resolved at the time registry receives notification for the host bundle?)
Comment 10 Oleg Besedin CLA 2011-07-11 12:15:46 EDT
Created attachment 199427 [details]
Stack trace - error in fragment resolution

The problem is in the fragment resolution.

I can only duplicate the issue on the first Eclipse start; once the bundle info file is reconciled, all works as expected.

I added translation packets into drop-in folder and used remote debugging to check the processing.

In the attached call stack the 	ManifestLocalization#findInFragments() line:

   BundleFragment[] fragments = searchBundle.getFragments();

returns only 2 fragments ("org.eclipse.jdt.compiler.apt", "org.eclipse.jdt.compiler.tool") while in my case there should have been five (two fragments as above + plus three NLS fragments.)

It seems that at the time the extension registry is activated, fragments added into drop-in folders are not resolved.
Comment 11 Thomas Watson CLA 2011-07-11 22:23:17 EDT
Created attachment 199460 [details]
possible fix

I think this may be a regression introduced by the fix to bug339211.  We record if a host has been processed a bit premature.  This prevents us from detecting that another fragment also being resolved actually provides translations to the host.

The fix is to not record the host as processed until we have actually caused it to refresh.  This fixes the problem for me.
Comment 12 Thomas Watson CLA 2011-07-11 22:24:18 EDT
(In reply to comment #10)
> Created attachment 199427 [details]
> Stack trace - error in fragment resolution
> 
> The problem is in the fragment resolution.
> 

It is a bug in the way the registry processes fragment resolution dynamically after the registry has been started.
Comment 13 Oleg Besedin CLA 2011-07-12 09:48:59 EDT
(In reply to comment #12)
> (In reply to comment #10)
> > Created attachment 199427 [details] [details]
> > Stack trace - error in fragment resolution
> > 
> > The problem is in the fragment resolution.
> > 
> 
> It is a bug in the way the registry processes fragment resolution dynamically
> after the registry has been started.

Hmm... The AbstractBundle#getFragments() returns 2 fragments while there are 5
fragments present. How is that right?
Comment 14 DJ Houghton CLA 2011-07-12 09:49:52 EDT
Patch looks good. Released to HEAD.
Comment 15 Thomas Watson CLA 2011-07-12 09:59:00 EDT
(In reply to comment #13)
> (In reply to comment #12)
> > (In reply to comment #10)
> > > Created attachment 199427 [details] [details] [details]
> > > Stack trace - error in fragment resolution
> > > 
> > > The problem is in the fragment resolution.
> > > 
> > 
> > It is a bug in the way the registry processes fragment resolution dynamically
> > after the registry has been started.
> 
> Hmm... The AbstractBundle#getFragments() returns 2 fragments while there are 5
> fragments present. How is that right?

I assume you mean at the time the registry is starting for the first time?  At this point simple configurator already started and installed the bundles based on what was in the initial bundles.info.  The initial bundles.info did not contain the NLS bundles.  Remember the NLS bundles are installed using that darn dropins mechanism.  Stuff from droppins does not get provisioned until the reconciler is run.  Once the reconciler runs it installs the fragment NLS bundles and they get resolved.  At this point the registry needs to be able to dynamically handle the resolution of the new fragments.