| Summary: | NPE when editing an xml file which hoses the xml model | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [WebTools] WTP Source Editing | Reporter: | Karen Butzke <karenfbutzke> | ||||||||
| Component: | wst.xml | Assignee: | Carl Anderson <ccc> | ||||||||
| Status: | VERIFIED FIXED | QA Contact: | Nitin Dahyabhai <thatnitind> | ||||||||
| Severity: | major | ||||||||||
| Priority: | P1 | CC: | ccc, david_williams, neil.hauge, nsand.dev | ||||||||
| Version: | 3.2 | Flags: | david_williams:
pmc_approved+
thatnitind: pmc_approved? (raghunathan.srinivasan) thatnitind: pmc_approved? (naci.dai) thatnitind: pmc_approved? (deboer) neil.hauge: pmc_approved+ thatnitind: pmc_approved? (kaloyan) ccc: review+ thatnitind: review+ |
||||||||
| Target Milestone: | 3.2 RC3 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows XP | ||||||||||
| Whiteboard: | PMC_approved | ||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 314752 | ||||||||||
| Attachments: |
|
||||||||||
Created attachment 167194 [details]
example jpa project
Created attachment 167195 [details]
proposed patch against head
The attached patch fixes a bug in EMF2DOMSSEAdapter.createAdapter(Node, translator) that allowed a null adapter to be returned. Line 287 of that method set the adapter to null and then primCreateAdapter(node, childMap) is never called.
Hi Nitin...I think you might be on vacation so copying David here. Any chance this bug/patch can be resolved for RC1? CCing Nick and Carl (since in DOM adapter). Can't imagine a null check would be an undesired change in behavior. Marking as "P1" just to mean "needs a response" ... naturally, the fix is up to the active committers ... perhaps there's a better one? But, otherwise, please review. Thank you. Carl, any thoughts? I approve of this change, but I admit that it does pose a risk of a behavior change very late in the WTP 3.2 release cycle, and thus there is not enough time left to test this through usage, which is my only concern. Here is the research and testing that I did to come to this conclusion: The first thing I noticed when I reviewed this change was that there is a createAdapter() in the super class, EMF2DOMAdapter, which is identical to the createAdapter() in EMF2DOMSSEAdapter. I tracked down the reason for the createAdapter() in EMF2DOMSSEAdapter- it was created in bug 232344. Through extensive research, I found a few adopter scenarios that were fixed, in part, by 232344. However, all of those scenarios have also been effected by other bugs- 232344 was not a complete fix for them. I put a breakpoint on the adapter = null line, and even though I ran the exact scenarios, none of them encountered that line. Last, one would expect a method named createAdapter() to actually create an adapter, if necessary. The current implementation will, in Karen's scenario, find an existing adapter, remove it, and then return null. Logically it makes sense in createAdapter to create a proper adapter for the node if the existing adapter is not the proper type. Carl, I don't understand how an identical protected method in a subclass could possibly be fixing a bug, how could that be necessary? That almost looks like it was a mistake made in the patch for bug 232344. Looks like the real fix is removing this method in EMF2DOMSSEEAdapter and fixing it in the superclass instead. Approving Karen's patch as the safer short-term fix. Released with +1/-0 during status call. please confirm, was this released to RC3? If so, please mark as "fixed". If not, should we rebuild RC3 for it? I have verified that this was released for RC3 with the tag v201005271618 verified fixed in build S-3.2.0RC3-20100529234347 |
Created attachment 167193 [details] NPE stack trace The attached NPE occurs when I take a valid orm.xml file and edit it as follows. Notice the '.' after class="model.Person". Once the NPE has occurred the model is pretty well hosed. You can tell this because of the Dali validation error: "The entity has no primary key attribute defined", which is not true since the 'id' element is specified. Removing the extraneous period does not solve the problem. I will attach a JPA project that shows this bug, import the project, switch to the JPA perspective and open the orm.xml file. Add the '.' and you will get the NPE. <entity class="model.Person".> <table name="person"/> <attributes> <id name="id"> </id> </attributes> </entity>