| Summary: | NullPointerException in EcoreEditor$5.isReadOnly | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Gregoire Dupe <gdupe> | ||||
| Component: | Edit | Assignee: | Ed Merks <Ed.Merks> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | ||||||
| Version: | 2.8.0 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 365843 | ||||||
| Attachments: |
|
||||||
The fix is committed to git head. The changes are available in the M6 build. |
Created attachment 208997 [details] Failing JUnit test Hello, When I execute the attached JUnit test, I get the following error: java.lang.NullPointerException at org.eclipse.emf.ecore.presentation.EcoreEditor$5.isReadOnly(EcoreEditor.java:853) at org.eclipse.emf.edit.command.AddCommand.prepare(AddCommand.java:388) at org.eclipse.emf.common.command.AbstractCommand.canExecute(AbstractCommand.java:114) at org.eclipse.emf.edit.command.AbstractOverrideableCommand.doCanExecute(AbstractOverrideableCommand.java:120) at org.eclipse.emf.edit.command.AbstractOverrideableCommand.canExecute(AbstractOverrideableCommand.java:113) at org.eclipse.emf.common.command.CommandWrapper.prepare(CommandWrapper.java:169) at org.eclipse.emf.common.command.AbstractCommand.canExecute(AbstractCommand.java:114) at org.eclipse.emf.common.command.CompoundCommand.prepare(CompoundCommand.java:247) at org.eclipse.emf.common.command.AbstractCommand.canExecute(AbstractCommand.java:114) at Bug.executeCommandAndCheck(Bug.java:89) at Bug.testScenario1WithAnEditorEditingDomain(Bug.java:83) 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:585) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.FailOnTimeout$1.run(FailOnTimeout.java:28) I've debugged the following method: org.eclipse.emf.ecore.presentation.new AdapterFactoryEditingDomain() {...}.isReadOnly(Resource) public boolean isReadOnly(Resource resource) { return "java".equals(resource.getURI().scheme()) || "xcore".equals(resource.getURI().fileExtension()) || super.isReadOnly(resource); } This is the parameter 'resource' which is null and not its URI. This not surprising because the method 'isReadOnly' is called by the following expression: domain.isReadOnly(owner.eResource()) The variable 'owner' contains the EClass that I've just created and not attached yet: I'm trying to execute the command which has to attach my EClass to its container. The attached file is composed of : - code written by my self ; - code copied from EMF Facet source code (EPL). (a) I, Gregoire Dupe, wrote 100% of the code I've provided. (b) I have the right to contribute the code to Eclipse. (c) I contribute the content under the EPL. (d) This contribution contains no Cryptography features. Regards, Grégoire