This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 223399 - A Web2.5 model fails to update after adding servlet and mappings using IModelProvider.modify
Summary: A Web2.5 model fails to update after adding servlet and mappings using IModel...
Status: CLOSED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: kiril mitov CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-20 15:58 EDT by Gerry Kessler CLA
Modified: 2008-03-24 12:35 EDT (History)
2 users (show)

See Also:


Attachments
fixes jsf creation. (1.89 KB, patch)
2008-03-21 04:26 EDT, Dimitar Giormov CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gerry Kessler CLA 2008-03-20 15:58:41 EDT
Using I-I20080320095049-20080320095049

The JSF facet creates, among other things, a Faces servlet and mappings, and adds them into the projet's web model.   This has suddenly stopped working and our code has not changed.   A J2EE (v2.4 Web module) model updates fine.

Steps to reproduce:
1) create dynamic web app with 2.5 web module
2) add JSF v1.2 facet (this will require creating a JSF implementation library from the JSF install property page, but that can be completely bogus)
3) Finish

Result: The web.xml file will lack a Faces Servlet entry and mapping.

Code can be found at org.eclipse.jst.jsf.core.internal.project.facet.JSFFacetInstallDelegate.
Comment 1 Chuck Bridgham CLA 2008-03-20 16:07:33 EDT
Kiril, can you take a look - recent regression with new models?
Comment 2 Kaloyan Raev CLA 2008-03-21 02:45:11 EDT
I confirm this is reproduced with build I20080320151231. 
Comment 3 kiril mitov CLA 2008-03-21 04:24:02 EDT
Hi Gerry,

Until the resolution of bug 198815 the model provider was working with only one instance of a model object. Modify method was working in all situations.

With the merged model provider we have introduced the notation of a: 
Merged model
Dd model
Annotation model

Since there is currently no support of modifying the annotation model, during the modify method we are providing the dd model as the instance to be modified. So all the modifications go to the dd model. Which is then persisted.

If you have previously get an instance to the merged model you CAN NOT use this instance during the modify method. You should get a new instance to the model object in the runnable method.

This from my point of view is consistent with the documentation of IModelProvider:modify which states that:
 * Note:  All implementors need to ensure all model access using this instance within the runnable block
 *        Use a cached/consistent view of the model that is being modified

So during the runnable block you will be provided with a consistent view of the model. You must just call modelProvider.getModelObject() in the begining of the runnable block. 

Most of the runnables for model modifications work in this way.
Comment 4 Dimitar Giormov CLA 2008-03-21 04:26:39 EDT
Created attachment 93098 [details]
fixes jsf creation.

This is one way to fix the creation. The modelObject in this case during the modify will be the XML model for sure.
Comment 5 Gerry Kessler CLA 2008-03-21 13:16:33 EDT
Thanks all.   I have checked in and released the fix in our code.
Comment 6 Gerry Kessler CLA 2008-03-21 18:04:32 EDT
Verified fixed using I20080321174820 
Comment 7 kiril mitov CLA 2008-03-24 12:35:51 EDT
Closed for I20080321174820