Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » "save failed" exception triggered by shipped GMF code
"save failed" exception triggered by shipped GMF code [message #155324] Mon, 15 October 2007 12:01 Go to next message
Eclipse UserFriend
Originally posted by: r.c.ladan.tue.nl

This is a multi-part message in MIME format.
--------------090105070401070306060508
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi,

I found a "Save failed" exception (see attachment) which was caused by
trying to save a diagram which was modified by this code:
Resource eRes = new XMIResourceImpl();
Resource res = eobj.eResource(); // save containing resource
eRes.getContents().add(eobj); // *

where eobj is defined as
((NodeImpl)((EObject)((GraphicalEditPart)((IStructuredSelect ion)
this.sel).getFirstElement()).getModel())).getElement())

and where sel is an ISelection set by the IActionDelegate.selectionChanged() listener.

The stack trace points to line 607 in meta.diagram.part.MetaDocumentProvider :
nextResource.save(MetaDiagramEditorUtil.getSaveOptions());

which itself cannot be the cause because getSaveOptions() always
returns a Map and nextResource is the next() value in an iteration.

The line with the * could be the cause, since it generates an
"Cannot modify resource set without a write transaction"
exception.

Versions:
* GMF 1.0.100 20070921-0000, build id 2.0.1
* Eclipse 3.4.0 I20070921-0919
* EMF 2.3.0 I20070925-2135
* GEF 3.4.0 20070919

Regards,
Rene

--------------090105070401070306060508
Content-Type: text/plain;
name="save failed.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="save failed.txt"

java.lang.NullPointerException
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.getHREF(XMLHelp erImpl.java:813)
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.getHREF(XMLHelp erImpl.java:802)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveHref(XMLSaveI mpl.java:2198)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveHRefSingle(XM LSaveImpl.java:2258)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1478)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1105)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:986)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2291)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1464)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2590)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XM LSaveImpl.java:653)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:581)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:253)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:205)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1253)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.saveOnlyIfC hangedWithMemoryBuffer(ResourceImpl.java:1083)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:956)
at meta.diagram.part.MetaDocumentProvider.doSaveDocument(MetaDo cumentProvider.java:607)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider$1SaveOperation.execute(AbstractDoc umentProvider.java:596)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider$DocumentProviderOperation.run(Abst ractDocumentProvider.java:66)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider.executeOperation(AbstractDocumentP rovider.java:530)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider.saveDocument(AbstractDocumentProvi der.java:579)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.performSave(DiagramDocumentEditor.java:8 25)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.doSave(DiagramDocumentEditor.java:646)
at org.eclipse.ui.internal.SaveableHelper$1.run(SaveableHelper. java:143)
at org.eclipse.ui.internal.SaveableHelper$4.run(SaveableHelper. java:266)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread( ModalContext.java:369)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:313)
at org.eclipse.jface.window.ApplicationWindow$1.run(Application Window.java:758)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWi ndow.java:755)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow. java:2451)
at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOpe ration(SaveableHelper.java:274)
at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOpe ration(SaveableHelper.java:253)
at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelp er.java:148)
at org.eclipse.ui.internal.EditorManager.savePart(EditorManager .java:1345)
at org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage .java:3202)
at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPa ge.java:3215)
at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:73)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498 )
at org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:543)
at org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:489)
at org.eclipse.jface.action.ActionContributionItem$6.handleEven t(ActionContributionItem.java:442)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3742)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3353)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 515)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:455)
at org.eclipse.equinox.launcher.Main.run(Main.java:1193)
at org.eclipse.equinox.launcher.Main.main(Main.java:1169)

--------------090105070401070306060508--
Re: "save failed" exception triggered by shipped GMF code [message #155344 is a reply to message #155324] Mon, 15 October 2007 12:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Rene,

Your eResource needs to have a URI since that URI is what other
resources will use to refer to objects contained by it. Generally you
should be using ResourceSet.createResource to create your resources...


Rene Ladan wrote:
> Hi,
>
> I found a "Save failed" exception (see attachment) which was caused by
> trying to save a diagram which was modified by this code:
> Resource eRes = new XMIResourceImpl();
> Resource res = eobj.eResource(); // save containing resource
> eRes.getContents().add(eobj); // *
>
> where eobj is defined as
> ((NodeImpl)((EObject)((GraphicalEditPart)((IStructuredSelect ion)
> this.sel).getFirstElement()).getModel())).getElement())
>
> and where sel is an ISelection set by the IActionDelegate.selectionChanged() listener.
>
> The stack trace points to line 607 in meta.diagram.part.MetaDocumentProvider :
> nextResource.save(MetaDiagramEditorUtil.getSaveOptions());
>
> which itself cannot be the cause because getSaveOptions() always
> returns a Map and nextResource is the next() value in an iteration.
>
> The line with the * could be the cause, since it generates an
> "Cannot modify resource set without a write transaction"
> exception.
>
> Versions:
> * GMF 1.0.100 20070921-0000, build id 2.0.1
> * Eclipse 3.4.0 I20070921-0919
> * EMF 2.3.0 I20070925-2135
> * GEF 3.4.0 20070919
>
> Regards,
> Rene
>
Re: "save failed" exception triggered by shipped GMF code [message #155392 is a reply to message #155344] Mon, 15 October 2007 14:53 Go to previous message
Eclipse UserFriend
Originally posted by: r.c.ladan.tue.nl

Hi Ed,

Ed Merks wrote:
> Rene,
>
> Your eResource needs to have a URI since that URI is what other
> resources will use to refer to objects contained by it. Generally you
> should be using ResourceSet.createResource to create your resources...
>
Indeed, changing this line

Resource eRes = new XMIResourceImpl();

to
ResourceSet rs = new ResourceSetImpl();
Resource eRes = rs.createResource(URI.createURI("http://com.tue.scenario"));

solves the problem.

Thanks,
Rene
Previous Topic:OWL export
Next Topic:GMF diagram as a dynamic view
Goto Forum:
  


Current Time: Thu Apr 25 22:40:27 GMT 2024

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

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

Back to the top