This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 337609 - No JPA model is built after creating a JPA project
Summary: No JPA model is built after creating a JPA project
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows 7
: P1 major (vote)
Target Milestone: 3.3 M6   Edit
Assignee: Nitin Dahyabhai CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-18 15:26 EST by Neil Hauge CLA
Modified: 2011-02-22 20:37 EST (History)
3 users (show)

See Also:


Attachments
Logged Exception (6.47 KB, text/plain)
2011-02-18 15:26 EST, Neil Hauge CLA
no flags Details
patch with test (2.56 KB, patch)
2011-02-22 20:24 EST, Nitin Dahyabhai CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Neil Hauge CLA 2011-02-18 15:26:42 EST
Created attachment 189316 [details]
Logged Exception

JPA project model is not built after new project creation.  This results in the JPA content not displaying in the Explorer.  It also prevents the Persistence XML Editor from opening for the generated persistence.xml file.

The reason the model is not built is because the generated persistence.xml file isn't committed, and therefor isn't read.  To workaround the issue you must save the persistence.xml file that has been generated into an edited state.  Once this is done, the model is built and everything goes back to normal.

The attached exception is logged.  Top of the stack is:



org.w3c.dom.DOMException: Not Found
at org.eclipse.wst.xml.core.internal.document.ElementImpl.removeAttributeNode(ElementImpl.java:1097)
at org.eclipse.wst.xml.core.internal.document.ElementImpl.removeAttributeNode(ElementImpl.java:1067)
at org.eclipse.wst.xml.core.internal.document.ElementImpl.removeAttribute(ElementImpl.java:1022)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterImpl.primUpdateDOMFeature(EMF2DOMAdapterImpl.java:1385)
at
Comment 1 Neil Hauge CLA 2011-02-18 15:28:42 EST
It would appear that a recent change (released in the last week) to WTP Common or WTP Source Editing has resulted in this issue.  This is a tracking bug for Dali.
Comment 2 Paul Fullbright CLA 2011-02-22 09:52:34 EST
It looks like the change of note was made in org.eclipse.wst.xml.core.internal.document.ElementImpl by Nitin (attaching Nitin) on 2/16/11.

The EMF2DOMSSEAdapter was calling ElementImpl.removeAttribute(String) (which then calls ElementImpl.removeAttributeNode(String)) without checking whether there was an attribute there or not.  And perhaps it was counting on there potentially not being an attribute.  Perhaps it was also using this API incorrectly.  I don't know.

But at any rate, with the changes to ElementImpl, there is now an exception thrown when there is no attribute of the given name, and file creation fails.

Nitin, do you know the correct behavior in this situation or where this bug should be assigned?
Comment 3 Nitin Dahyabhai CLA 2011-02-22 18:03:05 EST
It was caused by a subtle change in trying to improve our DOM conformance.  Element#removeAttribute(String) shouldn't be throwing that kind of exception.
Comment 4 Nitin Dahyabhai CLA 2011-02-22 20:24:38 EST
Created attachment 189563 [details]
patch with test
Comment 5 Nitin Dahyabhai CLA 2011-02-22 20:37:01 EST
Committed and released.