Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328642

Summary: Registering FacesConfigResourceFactory multiple times
Product: [WebTools] Java Server Faces Reporter: Carlin Rogers <carlin.rogers>
Component: JSF ToolsAssignee: jsf inbox <jsf-inbox>
Status: NEW --- QA Contact:
Severity: minor    
Priority: P3    
Version: 3.2.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Carlin Rogers CLA 2010-10-25 13:47:09 EDT
Noticed this while looking at memory leak issues. I think it is a minor issue but should probably get cleaned up some time.

I see our FacesConfigResourceFactory being registered multiple times - any time we create a new FacesConfigArtifactEdit instance and call getFacesConfig(). Seems like the "hack" that is in place (see comment in getFacesConfig()) to check if we've registered the factory is broken. I think we should try to fix this.

In addition, each instance is registered, adding to a HashMap in WTPResourceFactoryRegistry. Unfortunately, the key for the HashMap, WTPResourceFactoryRegistryKey, does not override hashCode/equals so though the keys are really the same, it creates references from the map to each of the separate instances of the factory.

A separate bug has been logged on about the HashMap key implementation.
See bug 328562.
Comment 1 Carlin Rogers CLA 2010-10-25 17:27:46 EDT
The FacesConfigPlugin inner plugin Implementation class' start() method is the first place to registers the FacesConfigResourceFactory.