Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF] Leading Slash in References to ID Attributes not allowed?
[EMF] Leading Slash in References to ID Attributes not allowed? [message #735570] Wed, 12 October 2011 08:53 Go to next message
Michael  Mühlberg is currently offline Michael MühlbergFriend
Messages: 33
Registered: July 2009
Member
Hello,

we just noticed that having a leading slash as content of an ID attribute of
an EMF class can not be handled by EMF references, is that a bug?

Example metamodel:

"Class1" has got a 1:1 reference "toClass2" to the "Class2". "Class2" has
got an ID-tagged String attribute with the name "name".

When one constructs a model via the generated model editor with a Class2
with the name "/ns/myName" and a Class1 that has got a reference to that
Class2 instance, closes and reopens the editor, one gets a
....NumberFormatException: For input string: "ns".

Ist this a known limitation that ID attributes can or should not have a
leading slash in it or should I report a bug?

Note that the example is not a productive one. I constructed it to reduce
the problem and to describe it here. We currently do have a real-life
problem in our productive code.

Can anyone help here?

Thanks in advance, Michael

-----------------

Here is the metamodel:

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mm"
nsURI="http://www.mm.com/mm" nsPrefix="mm">
<eClassifiers xsi:type="ecore:EClass" name="DocumentRoot">
<eStructuralFeatures xsi:type="ecore:EReference" name="toClass1"
upperBound="-1"
eType="#//Class1" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="toClass2"
upperBound="-1"
eType="#//Class2" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Class1">
<eStructuralFeatures xsi:type="ecore:EReference" name="toClass2"
eType="#//Class2"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Class2">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
iD="true"/>
</eClassifiers>
</ecore:EPackage>


And here the model:

<?xml version="1.0" encoding="UTF-8"?>
<mm:DocumentRoot xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:mm="http://www.mm.com/mm">
<toClass1 name="MyClass1" toClass2="/ns/MyClass2" />
<toClass2 name="/nsMyClass2"/>
</mm:DocumentRoot>


The exception during load is the following:

org.eclipse.emf.common.util.WrappedException:
java.lang.NumberFormatException: For input string: "ns"
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObjectForURIFragmentRootSegment(ResourceImpl.java:720)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:777)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:756)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.setValueFromId(XMLHandler.java:2816)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue(XMLHandler.java:2721)
at
org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAttribs(SAXXMIHandler.java:85)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFactory(XMLHandler.java:2193)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFeatureType(XMLHandler.java:2159)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHandler.java:2035)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.createObject(XMIHandler.java:134)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1840)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1023)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:87)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1001)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:712)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:169)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:181)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:242)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1511)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1290)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
at mm.presentation.MmEditor.createModel(MmEditor.java:945)
at mm.presentation.MmEditor.createPages(MmEditor.java:1002)
at
org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:348)
at
org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
at
org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
at
org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
at
org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
at
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at
org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
at
org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1245)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1198)
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1597)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:493)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:479)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
at
org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
at
org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
at
org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
at
org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:808)
at
org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:707)
at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:666)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2942)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2850)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2842)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2793)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2789)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2773)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2764)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610)
at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:355)
at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:164)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:249)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:228)
at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275)
at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
at
org.eclipse.jdt.internal.ui.navigator.OpenAndExpand.run(OpenAndExpand.java:50)
at org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:221)
at
org.eclipse.ui.navigator.CommonNavigatorManager$3.open(CommonNavigatorManager.java:185)
at
org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
at
org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:866)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at
org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864)
at
org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152)
at org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:462)
at
org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1256)
at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:269)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:309)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
com.sap.adt.product.branding.internal.application.AdtApplication.start(AdtApplication.java:78)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.lang.NumberFormatException: For input string: "ns"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Integer.parseInt(Integer.java:497)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObjectForURIFragmentRootSegment(ResourceImpl.java:716)
... 114 more
Re: [EMF] Leading Slash in References to ID Attributes not allowed? [message #735586 is a reply to message #735570] Wed, 12 October 2011 09:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31624
Registered: July 2009
Senior Member
Michael,

The leading slash is how EMF decides if the thing is an ID or a fragment
path; of course anyone could specialize their ResourceImpl to behave
differently. Characters like # and : are also going to cause problems
in the XMLHandler because that's how it will determine if the thing is a
QName representing a type, a full URI, or an ID; of course one could
serialize using something other than XML, and then this wouldn't be a
problem. In general, if you're going to serialize using XML/XMI, it's
best to restrict yourself to an NCName, i.e., anything that would be
valid as the name of an XML element or attribute. If you need special
characters in the actual values of the model, use a specialized
EDataType that encodes special characters; URI.encode/decode can be used
for that.


On 12/10/2011 10:53 AM, Michael Mühlberg wrote:
> Hello,
>
> we just noticed that having a leading slash as content of an ID attribute of
> an EMF class can not be handled by EMF references, is that a bug?
>
> Example metamodel:
>
> "Class1" has got a 1:1 reference "toClass2" to the "Class2". "Class2" has
> got an ID-tagged String attribute with the name "name".
>
> When one constructs a model via the generated model editor with a Class2
> with the name "/ns/myName" and a Class1 that has got a reference to that
> Class2 instance, closes and reopens the editor, one gets a
> ...NumberFormatException: For input string: "ns".
>
> Ist this a known limitation that ID attributes can or should not have a
> leading slash in it or should I report a bug?
>
> Note that the example is not a productive one. I constructed it to reduce
> the problem and to describe it here. We currently do have a real-life
> problem in our productive code.
>
> Can anyone help here?
>
> Thanks in advance, Michael
>
> -----------------
>
> Here is the metamodel:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mm"
> nsURI="http://www.mm.com/mm" nsPrefix="mm">
> <eClassifiers xsi:type="ecore:EClass" name="DocumentRoot">
> <eStructuralFeatures xsi:type="ecore:EReference" name="toClass1"
> upperBound="-1"
> eType="#//Class1" containment="true"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="toClass2"
> upperBound="-1"
> eType="#//Class2" containment="true"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Class1">
> <eStructuralFeatures xsi:type="ecore:EReference" name="toClass2"
> eType="#//Class2"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Class2">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
> iD="true"/>
> </eClassifiers>
> </ecore:EPackage>
>
>
> And here the model:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <mm:DocumentRoot xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:mm="http://www.mm.com/mm">
> <toClass1 name="MyClass1" toClass2="/ns/MyClass2" />
> <toClass2 name="/nsMyClass2"/>
> </mm:DocumentRoot>
>
>
> The exception during load is the following:
>
> org.eclipse.emf.common.util.WrappedException:
> java.lang.NumberFormatException: For input string: "ns"
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObjectForURIFragmentRootSegment(ResourceImpl.java:720)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:777)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:756)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.setValueFromId(XMLHandler.java:2816)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue(XMLHandler.java:2721)
> at
> org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAttribs(SAXXMIHandler.java:85)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFactory(XMLHandler.java:2193)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFeatureType(XMLHandler.java:2159)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHandler.java:2035)
> at
> org.eclipse.emf.ecore.xmi.impl.XMIHandler.createObject(XMIHandler.java:134)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1840)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1023)
> at
> org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:87)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1001)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:712)
> at
> org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:169)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
> at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
> at
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
> at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:181)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:242)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1511)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1290)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
> at mm.presentation.MmEditor.createModel(MmEditor.java:945)
> at mm.presentation.MmEditor.createPages(MmEditor.java:1002)
> at
> org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:348)
> at
> org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
> at
> org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
> at
> org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
> at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
> at
> org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
> at
> org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
> at
> org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
> at
> org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
> at
> org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1245)
> at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1198)
> at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1597)
> at org.eclipse.ui.internal.PartStack.add(PartStack.java:493)
> at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
> at org.eclipse.ui.internal.PartStack.add(PartStack.java:479)
> at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
> at
> org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
> at
> org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
> at
> org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
> at
> org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:808)
> at
> org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:707)
> at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:666)
> at
> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2942)
> at
> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2850)
> at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2842)
> at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2793)
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2789)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2773)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2764)
> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651)
> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610)
> at
> org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:355)
> at
> org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:164)
> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:249)
> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:228)
> at
> org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275)
> at
> org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
> at
> org.eclipse.jdt.internal.ui.navigator.OpenAndExpand.run(OpenAndExpand.java:50)
> at org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:221)
> at
> org.eclipse.ui.navigator.CommonNavigatorManager$3.open(CommonNavigatorManager.java:185)
> at
> org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
> at
> org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:866)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
> at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
> at
> org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864)
> at
> org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152)
> at org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:462)
> at
> org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1256)
> at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
> at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:269)
> at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:309)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> at
> com.sap.adt.product.branding.internal.application.AdtApplication.start(AdtApplication.java:78)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
> Caused by: java.lang.NumberFormatException: For input string: "ns"
> at
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> at java.lang.Integer.parseInt(Integer.java:447)
> at java.lang.Integer.parseInt(Integer.java:497)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObjectForURIFragmentRootSegment(ResourceImpl.java:716)
> ... 114 more
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EMF] Leading Slash in References to ID Attributes not allowed? [message #735675 is a reply to message #735586] Wed, 12 October 2011 14:12 Go to previous messageGo to next message
Michael  Mühlberg is currently offline Michael MühlbergFriend
Messages: 33
Registered: July 2009
Member
Hello Ed,

restricting to NCNames is not possible because we have to deal with names
that DO contain slashes at the beginning.

So, I will subclass the ResourceImpl and handle the situation on my own,
using the present protected methods of ResourceImple etc.

But, what about the generated editor for my example model below? Isn't it a
bug in the generated code that the editor can save such a model but not read
it from the persistence anymore?

Ciao, Michael



"Ed Merks" <ed.merks@gmail.com> wrote in message
news:j73l7h$i47$1@news.eclipse.org...
> Michael,
>
> The leading slash is how EMF decides if the thing is an ID or a fragment
> path; of course anyone could specialize their ResourceImpl to behave
> differently. Characters like # and : are also going to cause problems in
> the XMLHandler because that's how it will determine if the thing is a
> QName representing a type, a full URI, or an ID; of course one could
> serialize using something other than XML, and then this wouldn't be a
> problem. In general, if you're going to serialize using XML/XMI, it's
> best to restrict yourself to an NCName, i.e., anything that would be valid
> as the name of an XML element or attribute. If you need special
> characters in the actual values of the model, use a specialized EDataType
> that encodes special characters; URI.encode/decode can be used for that.
>
>
> On 12/10/2011 10:53 AM, Michael M
Re: [EMF] Leading Slash in References to ID Attributes not allowed? [message #735732 is a reply to message #735675] Wed, 12 October 2011 15:45 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31624
Registered: July 2009
Senior Member
Michael,

The problem with IDs is that whether they're valid or not depends on the
resource implementation so we could scan what we're saving and complain
about it so that the save fails, but that's yet more cost, so yet
another option, and therefore yet more complexity, which in the end few
will ever want to use. Even in your case, you plan to specialize it, so
why bother with any further complexity in the core...


On 12/10/2011 4:12 PM, Michael Mühlberg wrote:
> Hello Ed,
>
> restricting to NCNames is not possible because we have to deal with names
> that DO contain slashes at the beginning.
>
> So, I will subclass the ResourceImpl and handle the situation on my own,
> using the present protected methods of ResourceImple etc.
>
> But, what about the generated editor for my example model below? Isn't it a
> bug in the generated code that the editor can save such a model but not read
> it from the persistence anymore?
>
> Ciao, Michael
>
>
>
> "Ed Merks"<ed.merks@gmail.com> wrote in message
> news:j73l7h$i47$1@news.eclipse.org...
>> Michael,
>>
>> The leading slash is how EMF decides if the thing is an ID or a fragment
>> path; of course anyone could specialize their ResourceImpl to behave
>> differently. Characters like # and : are also going to cause problems in
>> the XMLHandler because that's how it will determine if the thing is a
>> QName representing a type, a full URI, or an ID; of course one could
>> serialize using something other than XML, and then this wouldn't be a
>> problem. In general, if you're going to serialize using XML/XMI, it's
>> best to restrict yourself to an NCName, i.e., anything that would be valid
>> as the name of an XML element or attribute. If you need special
>> characters in the actual values of the model, use a specialized EDataType
>> that encodes special characters; URI.encode/decode can be used for that.
>>
>>
>> On 12/10/2011 10:53 AM, Michael Mühlberg wrote:
>>> Hello,
>>>
>>> we just noticed that having a leading slash as content of an ID attribute
>>> of
>>> an EMF class can not be handled by EMF references, is that a bug?
>>>
>>> Example metamodel:
>>>
>>> "Class1" has got a 1:1 reference "toClass2" to the "Class2". "Class2" has
>>> got an ID-tagged String attribute with the name "name".
>>>
>>> When one constructs a model via the generated model editor with a Class2
>>> with the name "/ns/myName" and a Class1 that has got a reference to that
>>> Class2 instance, closes and reopens the editor, one gets a
>>> ...NumberFormatException: For input string: "ns".
>>>
>>> Ist this a known limitation that ID attributes can or should not have a
>>> leading slash in it or should I report a bug?
>>>
>>> Note that the example is not a productive one. I constructed it to reduce
>>> the problem and to describe it here. We currently do have a real-life
>>> problem in our productive code.
>>>
>>> Can anyone help here?
>>>
>>> Thanks in advance, Michael
>>>
>>> -----------------
>>>
>>> Here is the metamodel:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <ecore:EPackage xmi:version="2.0"
>>> xmlns:xmi="http://www.omg.org/XMI"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mm"
>>> nsURI="http://www.mm.com/mm" nsPrefix="mm">
>>> <eClassifiers xsi:type="ecore:EClass" name="DocumentRoot">
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="toClass1"
>>> upperBound="-1"
>>> eType="#//Class1" containment="true"/>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="toClass2"
>>> upperBound="-1"
>>> eType="#//Class2" containment="true"/>
>>> </eClassifiers>
>>> <eClassifiers xsi:type="ecore:EClass" name="Class1">
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="toClass2"
>>> eType="#//Class2"/>
>>> </eClassifiers>
>>> <eClassifiers xsi:type="ecore:EClass" name="Class2">
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
>>> iD="true"/>
>>> </eClassifiers>
>>> </ecore:EPackage>
>>>
>>>
>>> And here the model:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <mm:DocumentRoot xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>>> xmlns:mm="http://www.mm.com/mm">
>>> <toClass1 name="MyClass1" toClass2="/ns/MyClass2" />
>>> <toClass2 name="/nsMyClass2"/>
>>> </mm:DocumentRoot>
>>>
>>>
>>> The exception during load is the following:
>>>
>>> org.eclipse.emf.common.util.WrappedException:
>>> java.lang.NumberFormatException: For input string: "ns"
>>> at
>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObjectForURIFragmentRootSegment(ResourceImpl.java:720)
>>> at
>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:777)
>>> at
>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:756)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.setValueFromId(XMLHandler.java:2816)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue(XMLHandler.java:2721)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAttribs(SAXXMIHandler.java:85)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFactory(XMLHandler.java:2193)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFeatureType(XMLHandler.java:2159)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHandler.java:2035)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMIHandler.createObject(XMIHandler.java:134)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1840)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1023)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:87)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1001)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:712)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:169)
>>> at
>>> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
>>> at
>>> com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
>>> at
>>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
>>> at
>>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)
>>> at
>>> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
>>> at
>>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
>>> at
>>> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
>>> at
>>> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
>>> at
>>> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
>>> at
>>> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
>>> at
>>> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
>>> at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:181)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:242)
>>> at
>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1511)
>>> at
>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1290)
>>> at
>>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
>>> at
>>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
>>> at
>>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
>>> at mm.presentation.MmEditor.createModel(MmEditor.java:945)
>>> at mm.presentation.MmEditor.createPages(MmEditor.java:1002)
>>> at
>>> org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:348)
>>> at
>>> org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
>>> at
>>> org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
>>> at
>>> org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
>>> at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
>>> at
>>> org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
>>> at
>>> org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
>>> at
>>> org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
>>> at
>>> org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
>>> at
>>> org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1245)
>>> at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1198)
>>> at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1597)
>>> at org.eclipse.ui.internal.PartStack.add(PartStack.java:493)
>>> at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
>>> at org.eclipse.ui.internal.PartStack.add(PartStack.java:479)
>>> at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
>>> at
>>> org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
>>> at
>>> org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
>>> at
>>> org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
>>> at
>>> org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:808)
>>> at
>>> org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:707)
>>> at
>>> org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:666)
>>> at
>>> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2942)
>>> at
>>> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2850)
>>> at
>>> org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2842)
>>> at
>>> org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2793)
>>> at
>>> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
>>> at
>>> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2789)
>>> at
>>> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2773)
>>> at
>>> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2764)
>>> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651)
>>> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610)
>>> at
>>> org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:355)
>>> at
>>> org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:164)
>>> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:249)
>>> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:228)
>>> at
>>> org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275)
>>> at
>>> org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
>>> at
>>> org.eclipse.jdt.internal.ui.navigator.OpenAndExpand.run(OpenAndExpand.java:50)
>>> at org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:221)
>>> at
>>> org.eclipse.ui.navigator.CommonNavigatorManager$3.open(CommonNavigatorManager.java:185)
>>> at
>>> org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
>>> at
>>> org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:866)
>>> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
>>> at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
>>> at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
>>> at
>>> org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864)
>>> at
>>> org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152)
>>> at
>>> org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:462)
>>> at
>>> org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1256)
>>> at
>>> org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
>>> at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:269)
>>> at
>>> org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:309)
>>> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
>>> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
>>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
>>> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
>>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
>>> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
>>> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
>>> at
>>> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>>> at
>>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
>>> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
>>> at
>>> com.sap.adt.product.branding.internal.application.AdtApplication.start(AdtApplication.java:78)
>>> at
>>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>>> at
>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>>> at
>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
>>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
>>> at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
>>> at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
>>> Caused by: java.lang.NumberFormatException: For input string: "ns"
>>> at
>>> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
>>> at java.lang.Integer.parseInt(Integer.java:447)
>>> at java.lang.Integer.parseInt(Integer.java:497)
>>> at
>>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObjectForURIFragmentRootSegment(ResourceImpl.java:716)
>>> ... 114 more
>>>
>>>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EMF] Leading Slash in References to ID Attributes not allowed? [message #735759 is a reply to message #735732] Wed, 12 October 2011 16:06 Go to previous message
Michael  Mühlberg is currently offline Michael MühlbergFriend
Messages: 33
Registered: July 2009
Member
Yes, it is always a tradeoff between costs and benefit.

I tried out to use other protected methods from ResourceImpl and it works
fine for me.

Thanks Ed, cu in Ludwigsburg hopefully this year, Michael


"Ed Merks" <ed.merks@gmail.com> wrote in message
news:j74c0f$bt1$1@news.eclipse.org...
> Michael,
>
> The problem with IDs is that whether they're valid or not depends on the
> resource implementation so we could scan what we're saving and complain
> about it so that the save fails, but that's yet more cost, so yet another
> option, and therefore yet more complexity, which in the end few will ever
> want to use. Even in your case, you plan to specialize it, so why bother
> with any further complexity in the core...
>
>
> On 12/10/2011 4:12 PM, Michael M
Previous Topic:Suppressing Model Objects (ch 19.2.1 of THE BOOK)
Next Topic:[EEF] leverage EEF to generate a INewWizard
Goto Forum:
  


Current Time: Sun Nov 29 20:47:43 GMT 2020

Powered by FUDForum. Page generated in 0.02100 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top