Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » NullPointerException when saving table representation
NullPointerException when saving table representation [message #1699788] Fri, 26 June 2015 15:11 Go to next message
Ulyana Tikhonova is currently offline Ulyana TikhonovaFriend
Messages: 5
Registered: March 2015
Junior Member
Dear all,

I have developed a graphical editor for my ecore-based models using Sirius cross tables. Unfortunately, when I use this editor, I fail to save my models because of the following exception:

java.lang.NullPointerException
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.doSave(DAnalysisSessionImpl.java:1039)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl$Saver.saveNow(DAnalysisSessionImpl.java:251)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl$Saver.save(DAnalysisSessionImpl.java:232)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.save(DAnalysisSessionImpl.java:989)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.save(DAnalysisSessionImpl.java:984)
	at org.eclipse.sirius.ui.tools.internal.editor.AbstractDTreeEditor.performSave(AbstractDTreeEditor.java:277)
	at org.eclipse.sirius.table.ui.tools.internal.editor.AbstractDTableEditor.doSave(AbstractDTableEditor.java:160)
	at org.eclipse.sirius.ui.business.internal.session.SessionSaveable.doSave(SessionSaveable.java:64)
...


(I use Sirius version 2.0.3.201501210814 )
It looks like the exception happens because save.getResult() returns null in the following code of the org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.java:
if (!save.getStatus().isOK()) {
                SiriusPlugin.getDefault().error("save failed", new CoreException(save.getStatus()));
            } else { 
                Collection<Resource> savedResources = save.getResult();
                boolean semanticSave = false;
                for (final Resource resource : savedResources) {
                    if (semanticResourcesCollection.contains(resource) || getControlledResources().contains(resource)) {
                        semanticSave = true;
                    }
                }
...


I cannot reproduce this problem in a stable way though: for some models the error appears all the time, and I just cannot save them, for some models this error never shows up; in different eclipse development environments I also get different behavior. The most problematic is that this error appears in the end-user product that we deploy.

I would really appreciate if somebody could give me a hint what can be wrong here!

Thank you,
Ulyana
Re: NullPointerException when saving table representation [message #1699906 is a reply to message #1699788] Mon, 29 June 2015 08:08 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Ulyana,

Le 26/06/2015 21:53, Ulyana Tikhonova a écrit :
> Dear all,
>
> I have developed a graphical editor for my ecore-based models using
> Sirius cross tables. Unfortunately, when I use this editor, I fail to
> save my models because of the following exception:
> java.lang.NullPointerException
> at
> org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.doSave(DAnalysisSessionImpl.java:1039)
>
> at
> org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl$Saver.saveNow(DAnalysisSessionImpl.java:251)
>
> at
> org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl$Saver.save(DAnalysisSessionImpl.java:232)
>
> at
> org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.save(DAnalysisSessionImpl.java:989)
>
> at
> org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.save(DAnalysisSessionImpl.java:984)
>
> at
> org.eclipse.sirius.ui.tools.internal.editor.AbstractDTreeEditor.performSave(AbstractDTreeEditor.java:277)
>
> at
> org.eclipse.sirius.table.ui.tools.internal.editor.AbstractDTableEditor.doSave(AbstractDTableEditor.java:160)
>
> at
> org.eclipse.sirius.ui.business.internal.session.SessionSaveable.doSave(SessionSaveable.java:64)
>
> ..
>
> (I use Sirius version 2.0.3.201501210814 )
> It looks like the exception happens because save.getResult() returns
> null in the following code of the
> org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.java:
>
> if (!save.getStatus().isOK()) {
> SiriusPlugin.getDefault().error("save failed", new
> CoreException(save.getStatus()));
> } else { Collection<Resource> savedResources
> = save.getResult();
> boolean semanticSave = false;
> for (final Resource resource : savedResources) {
> if (semanticResourcesCollection.contains(resource)
> || getControlledResources().contains(resource)) {
> semanticSave = true;
> }
> }
> ..
>

The use of this status has been removed in Sirius 3.0.0 (Bug 458050 [1]).




> I cannot reproduce this problem in a stable way though: for some models
> the error appears all the time, and I just cannot save them, for some
> models this error never shows up; in different eclipse development
> environments I also get different behavior. The most problematic is that
> this error appears in the end-user product that we deploy.
>
> I would really appreciate if somebody could give me a hint what can be
> wrong here!

In 2.0.x, Sirius sets the status of the save runnable:

RunnableWithResult<Collection<Resource>> save = new
RunnableWithResult.Impl<Collection<Resource>>() {
@Override
public void run() {
try {
Collection<Resource> savedResources =
getSavingPolicy().save(allResources, options, new
SubProgressMonitor(monitor, 7));
setResult(savedResources);
setStatus(Status.OK_STATUS);
catch (Throwable e) {
setStatus(new Status(IStatus.ERROR, SiriusPlugin.ID, "error while
saving", e));
}
}
};

But in
org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive:


[...]
try {
tx.commit();

if (rwr != null) {
rwr.setStatus(Status.OK_STATUS);
}
} catch (RollbackException e) {
[...]
if (rwr != null) {
rwr.setStatus(e.getStatus());
}
}

It seems that in your situation, you might have a RollbackException
occuring during the transaction.commit with no status.

Could you try to look into this on your side on one of your failing model ?

>
> Thank you,
> Ulyana

Regards

--
Maxime - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
--
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=458050


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: NullPointerException when saving table representation [message #1699928 is a reply to message #1699906] Mon, 29 June 2015 10:28 Go to previous messageGo to next message
Ulyana Tikhonova is currently offline Ulyana TikhonovaFriend
Messages: 5
Registered: March 2015
Junior Member
Hi Maxime,
Thank you for your response!

In my case the NullPointerException is triggered in the code line:
for (final Resource resource : savedResources)

because savedResources is null. So save.getStatus().isOK() returns true, status is Ok, but save.getResult() returns null.

I guess this is not RollbackException, as org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive does not appear in the trace. Here is the complete trace of the exception I get:
!MESSAGE Save Failed
!STACK 0
java.lang.NullPointerException
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.doSave(DAnalysisSessionImpl.java:1039)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl$Saver.saveNow(DAnalysisSessionImpl.java:251)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl$Saver.save(DAnalysisSessionImpl.java:232)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.save(DAnalysisSessionImpl.java:989)
	at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.save(DAnalysisSessionImpl.java:984)
	at org.eclipse.sirius.ui.tools.internal.editor.AbstractDTreeEditor.performSave(AbstractDTreeEditor.java:277)
	at org.eclipse.sirius.table.ui.tools.internal.editor.AbstractDTableEditor.doSave(AbstractDTableEditor.java:160)
	at org.eclipse.sirius.ui.business.internal.session.SessionSaveable.doSave(SessionSaveable.java:64)
	at org.eclipse.ui.Saveable.doSave(Saveable.java:216)
	at org.eclipse.ui.internal.SaveableHelper.doSaveModel(SaveableHelper.java:355)
	at org.eclipse.ui.internal.SaveableHelper$3.run(SaveableHelper.java:199)
	at org.eclipse.ui.internal.SaveableHelper$5.run(SaveableHelper.java:283)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:466)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:374)
	at org.eclipse.ui.internal.WorkbenchWindow$13.run(WorkbenchWindow.java:2157)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2153)
	at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:291)
	at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:269)
	at org.eclipse.ui.internal.SaveableHelper.saveModels(SaveableHelper.java:211)
	at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:146)
	at org.eclipse.ui.internal.WorkbenchPage.saveSaveable(WorkbenchPage.java:3915)
	at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3929)
	at org.eclipse.ui.internal.handlers.SaveHandler.execute(SaveHandler.java:54)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
	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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:247)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:229)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:149)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:286)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:507)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:558)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:378)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:324)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:86)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1060)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1070)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1112)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1108)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1529)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4722)
	at org.eclipse.swt.widgets.Tree.WM_CHAR(Tree.java:6028)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4610)
	at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:6024)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5023)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
	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:648)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1438)


Any further suggestions?

Thank you,
Ulyana
Re: NullPointerException when saving table representation [message #1699958 is a reply to message #1699928] Mon, 29 June 2015 13:09 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Ulyana,

Le 29/06/2015 12:28, Ulyana Tikhonova a écrit :
> Hi Maxime,
> Thank you for your response!
>
> In my case the NullPointerException is triggered in the code line:
> for (final Resource resource : savedResources)
> because savedResources is null. So save.getStatus().isOK() returns true,
> status is Ok, but save.getResult() returns null.

Could you check which saving policy is used ? Do you set a specific
saving policy ? Do you have the Xtext resources and the Sirius-Xtext
bridge installed (it will change the saving policy if Xtext resources
are detected).

The different saving policy I see in Sirius seem to always return a non
null result.

Could you also look into the error log if there are some "error while
saving session" entries which could give us more information ?



> I guess this is not RollbackException, as
> org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive
> does not appear in the trace. Here is the complete trace of the
> exception I get:
>
> !MESSAGE Save Failed
> !STACK 0
> java.lang.NullPointerException
> at
> org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.doSave(DAnalysisSessionImpl.java:1039)
>


When the save is not in an Exclusive transaction, the
TransactionalEditingDomainImpl.runExclusive will put Status.OK_STATUS as
status except in case of a rollback.

If an error happens during the saving policy save(), the result of the
runnable will be null and not an empty list but the status will be ok.

Could you report a bug for this ?

>
>
> Any further suggestions?
>
> Thank you,
> Ulyana

Regards,

--
Maxime - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
--

[1] https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Sirius


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: NullPointerException when saving table representation [message #1700012 is a reply to message #1699958] Mon, 29 June 2015 15:59 Go to previous messageGo to next message
Ulyana Tikhonova is currently offline Ulyana TikhonovaFriend
Messages: 5
Registered: March 2015
Junior Member
Hi Maxime,

I checked step-by-step what happens in the org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.doSave() in the debug mode. It also allowed me to get into the org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(), indeed. Here is what I observe:
- saving policy of the DAnalysisSessionImpl is null;
- in the run() of new RunnableWithResult.Impl<Collection<Resource>> new saving policy is created with the TransactionalEditingDomainImpl instance as its domain;
- the save() of this newly created policy throws an exception java.lang.UnsupportedOperationException;
- as a result status is changed into "error while saving";
- then the code from org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive() works fine without throwing (Rollback) exception:
tx.commit();
if (rwr != null) {
rwr.setStatus(Status.OK_STATUS);
}
- as a result the status is set to OK (rwr.status), but the result is null (rwr.result).
This latter null causes the NullPointerException. And no log is written for the "error while saving session".

I tried to dig deeper - to see where this UnsupportedOperationException comes from, but I got lost in the low level java classes such as Iteratable, List, etc. If it can help, I will describe the whole process step-by-step.

I didn't really get what bug you mean. Could you please clarify, so that my bug report is also clear?

Thank you,
Ulyana
Re: NullPointerException when saving table representation [message #1700014 is a reply to message #1699958] Mon, 29 June 2015 16:14 Go to previous messageGo to next message
Ulyana Tikhonova is currently offline Ulyana TikhonovaFriend
Messages: 5
Registered: March 2015
Junior Member
Sorry, I forgot to about xtext.

Yes, I use Xtext, but not in the direct combination with Sirius. Although my models from Sirius editor do refer to models, created and stored using Xtext. But I don't have Sirius-Xtext bridge installed. Might this be a reason of the problem?
Re: NullPointerException when saving table representation [message #1700109 is a reply to message #1700012] Tue, 30 June 2015 07:49 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Ulyana,

Le 29/06/2015 17:59, Ulyana Tikhonova a écrit :
> Hi Maxime,
>
> I checked step-by-step what happens in the
> org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.doSave()
> in the debug mode. It also allowed me to get into the
> org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(),
> indeed. Here is what I observe:
> - saving policy of the DAnalysisSessionImpl is null;
> - in the run() of new RunnableWithResult.Impl<Collection<Resource>> new
> saving policy is created with the TransactionalEditingDomainImpl
> instance as its domain;

> - the save() of this newly created policy throws an exception
> java.lang.UnsupportedOperationException;

It could be very interesting to have the corresponding stack, could you
try to debug with a Java Exception breakpoint for
java.lang.UnsupportedOperationException or with breakpoints in its
constructors ? This will allow to point the real cause of your issue.



> - as a result status is changed into "error while saving";
> - then the code from
> org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive()
> works fine without throwing (Rollback) exception: tx.commit();
> if (rwr != null) {
> rwr.setStatus(Status.OK_STATUS);
> }
> - as a result the status is set to OK (rwr.status), but the result is
> null (rwr.result).
> This latter null causes the NullPointerException. And no log is written
> for the "error while saving session".

This has been corrected on Sirius 3.0 (See Bug 458050 [1]) to improve
the save failures report


>
> I tried to dig deeper - to see where this UnsupportedOperationException
> comes from, but I got lost in the low level java classes such as
> Iteratable, List, etc. If it can help, I will describe the whole process
> step-by-step.
>
> I didn't really get what bug you mean. Could you please clarify, so that
> my bug report is also clear?

We should avoid to get the NPE and handle a null result for the save
runnable.

>
> Thank you,
> Ulyana


Regards,

--
Maxime - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
--
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=458050


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: NullPointerException when saving table representation [message #1700110 is a reply to message #1700014] Tue, 30 June 2015 08:00 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Le 29/06/2015 18:14, Ulyana Tikhonova a écrit :
> Sorry, I forgot to about xtext.
>
> Yes, I use Xtext, but not in the direct combination with Sirius.
> Although my models from Sirius editor do refer to models, created and
> stored using Xtext. But I don't have Sirius-Xtext bridge installed.
> Might this be a reason of the problem?

The bridge detects that Xtext resources are used and changes the saving
policy to disable the XText validation during save and avoid some false
positive errors and some checks on the model structure then it delegates
the save to the IsModifiedSavingPolicy (which became the default saving
policy in Sirius 3.0) to detect the resources to save and avoid to save
in a temporary resource to detect changes like the SavingPolicyImpl does.

The bridge also make Sirius use an XTextResourceSet and configures the
classpath uri context, the uri converter, the classpath uri resolver.
And set set some options like the live scope.

You will find the corresponding code in [1]

The XText validation done during save might be the cause of your problem
or you might also have a model which is not serializable by Xtext
because an element has no name or an other empty attribute.


Regards



--
Maxime - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
--

[1]
http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/tree/plugins/org.eclipse.sirius.common.xtext/src/org/eclipse/sirius/common/xtext/internal


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: NullPointerException when saving table representation [message #1700120 is a reply to message #1700110] Tue, 30 June 2015 09:47 Go to previous message
Ulyana Tikhonova is currently offline Ulyana TikhonovaFriend
Messages: 5
Registered: March 2015
Junior Member
Hi Maxime,

So I examined the execution deeper and here are what I found:

1. UsupportedOperationException has empty stacktrace (at least in my variable view during debug), but I managed to find the place where it is thrown.

2. When saving my model Sirius takes all resources from the current project and checks which of them should be saved. Some resources are indeed referenced from the model, but some resources has no connection with the model at all. The xtext resource is used by my model, but it does not trigger any errors, at least not those that lead to the NPE. What triggers the error is another resource, that is not even required by my model. Particularly, in SavingPolicyImpl::hasChangesToSave() in this code line:
hasChangesToSave = diagnose.isSaveable() && diagnose.hasDifferentSerialization(mergedOptions);
diagnose.isSaveable() returns false, but diagnose.hasDifferentSerialization still tries to save the resource into a temporary file. The latter fails.

3. The resource that triggers the error was created using the third party product. Apparently they didn't override doSave() for the org.eclipse.emf.ecore.resource.impl.ResourceImpl. This method must be overriden by clients, and it throws UsupportedOperationException otherwise. I will post the corresponding question on their forum.

To conclude, I guess that a workaround is to somehow remove this third party resource from the list of resources that are being checked by Sirius. I removed the third party resource from the project, and indeed sirius-based model got saved without any problems. Still, it's a pity that this dependency on bugs of other plug-ins exist.

Thank you for all the support!
Ulyana
Previous Topic:Simplify diagram creation
Next Topic:Sirius Layout
Goto Forum:
  


Current Time: Fri Mar 29 05:19:46 GMT 2024

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

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

Back to the top