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

Bug 222109

Summary: exceptions typing in orm.xml source
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: GeneralAssignee: Paul Fullbright <paul.fullbright>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: neil.hauge
Version: 2.0   
Target Milestone: 2.0 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 225196    
Bug Blocks:    

Description Karen Butzke CLA 2008-03-10 15:26:39 EDT
Given the following orm.xml:

<entity-mappings>
	<entity class="foo.Employee">
		<attributes></attributes>
	</entity>
</entity-mappings>

The simplist way I have found to reproduce this exception is press enter after the entity closing tag and then press enter after the attributes closing tag.  After this almost anything you type in the xml will cause an exception.  

I have been digging around in debug trying to determine if this is a Dali bug or an underlying translator/sse bug, but have not had any luck.  If you are debugging I noticed that the Attributes object is created a second time when you press enter after the entity closing tag.  Beyond that, I didn't figure much out.

A structured model client, EMF2DOMSSEAdapter(attributes,null) threw following exception during adapter notification (CONTENT_CHANGED )

java.lang.NullPointerException
at org.eclipse.wst.common.internal.emf.resource.IDTranslator.setMOFValue(IDTranslator.java:45)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterImpl.primUpdateMOFFeature(EMF2DOMAdapterImpl.java:1408)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterImpl.updateMOFFeature(EMF2DOMAdapterImpl.java:1777)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterImpl.primUpdateMOF(EMF2DOMAdapterImpl.java:936)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterImpl.updateMOF(EMF2DOMAdapterImpl.java:916)
at org.eclipse.wst.xml.core.internal.emf2xml.EMF2DOMSSEAdapter.notifyChanged(EMF2DOMSSEAdapter.java:227)
at org.eclipse.wst.sse.core.internal.provisional.AbstractNotifier.notify(AbstractNotifier.java:201)
at org.eclipse.wst.xml.core.internal.document.XMLModelNotifierImpl.notify(XMLModelNotifierImpl.java:238)
at org.eclipse.wst.xml.core.internal.document.XMLModelNotifierImpl.notifyDeferred(XMLModelNotifierImpl.java:340)
at org.eclipse.wst.xml.core.internal.document.XMLModelNotifierImpl.endChanging(XMLModelNotifierImpl.java:178)
at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.changedModel(DOMModelImpl.java:163)
at org.eclipse.wst.sse.core.internal.model.AbstractStructuredModel$DocumentToModelNotifier.regionChanged(AbstractStructuredModel.java:164)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument._fireEvent(BasicStructuredDocument.java:548)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.fireStructuredDocumentEvent(BasicStructuredDocument.java:1187)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.internalReplaceText(BasicStructuredDocument.java:1961)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2411)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2407)
at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.access$0(JobSafeStructuredDocument.java:1)
at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument$1.run(JobSafeStructuredDocument.java:98)
at org.eclipse.wst.sse.ui.EditorExecutionContext.execute(EditorExecutionContext.java:42)
at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.replaceText(JobSafeStructuredDocument.java:109)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2396)
at org.eclipse.wst.sse.ui.internal.StructuredDocumentToTextAdapter.replaceTextRange(StructuredDocumentToTextAdapter.java:1187)
Comment 1 Karen Butzke CLA 2008-03-10 15:55:01 EDT
actually the steps to reproduce are:
1.Press enter after the entity closing tag
2.Press enter after the attributes opening tag
Comment 2 Karen Butzke CLA 2008-04-01 15:09:17 EDT
The original exception does not occurs anymore.  But editing anything else in the source file still causes many exceptions.  here are new steps to reproduce:

Press enter after the entity closing tag.  The go inside the attributes tag and add a new attribute, such as id.  You will get an exception with every attributes you add and while typing in the name of the attributes.  The Attributes resource model object is being recreated when you press enter after the entity closing tag, thus our model gets screwed up.

java.lang.NullPointerException
	at org.eclipse.jpt.core.resource.common.AbstractJpaEObject.featureChanged(AbstractJpaEObject.java:101)
	at org.eclipse.jpt.core.resource.common.AbstractJpaEObject.eNotify(AbstractJpaEObject.java:95)
	at org.eclipse.jpt.core.resource.orm.AbstractXmlAttributeMapping.setName(AbstractXmlAttributeMapping.java:112)
	at org.eclipse.jpt.core.resource.orm.AbstractXmlAttributeMapping.eSet(AbstractXmlAttributeMapping.java:142)
	at org.eclipse.jpt.core.resource.orm.XmlIdImpl.eSet(XmlIdImpl.java:463)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1071)
	at org.eclipse.wst.common.internal.emf.utilities.ExtendedEcoreUtil.eSetOrAdd(ExtendedEcoreUtil.java:79)
	at org.eclipse.wst.common.internal.emf.resource.Translator.setMOFValue(Translator.java:612)
	at org.eclipse.wst.common.internal.emf.resource.Translator.setMOFValue(Translator.java:627)
	at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterImpl.primUpdateMOFFeature(EMF2DOMAdapterImpl.java:1436)
	at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterImpl.updateMOFFeature(EMF2DOMAdapterImpl.java:1779)
	at org.eclipse.wst.xml.core.internal.emf2xml.EMF2DOMSSEAdapter.notifyChanged(EMF2DOMSSEAdapter.java:233)
Comment 3 Karen Butzke CLA 2008-04-03 09:26:59 EDT
underlying bug 225196 was fixed, I have verified this bug is fixed in the
latest WTP ibuild