Community
Participate
Working Groups
Build Identifier: 20110319-2305 AbstractFeatureProvider.link(PictogramElement pictogramElement, Object[] businessObjects) should check that Business Object's .eResource() and .getResourceSet() are not null before using. If something is null, throw a descriptive exception (message e.g.: The business object's resource/resourceset must be set before it is linked to the pictogram.) Whenever I forget to set the resource, I spend a few minutes tracking down a generic NullPointerException, only to find that this is the issue. Reproducible: Always Steps to Reproduce: 1. In a AbstractCreateConnectionFeature in Graphiti using emf model 2. create a new emf business model object, do not link it to the resourceset 3. in create method override, call IFeatureProvider.addIfPossible 4. NullPointerException occurs: !ENTRY org.eclipse.graphiti 4 0 2011-05-16 14:28:39.462 !MESSAGE CommandExec.executeCommand() java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at org.eclipse.graphiti.features.impl.AbstractFeatureProvider.link(AbstractFeatureProvider.java:639) at org.eclipse.graphiti.features.impl.AbstractFeature.link(AbstractFeature.java:205) at org.eclipse.graphiti.features.impl.AbstractFeature.link(AbstractFeature.java:193) at mypackage.AddConnectionFeature.add(AddConnectionFeature.java:43) at org.eclipse.graphiti.internal.command.AddFeatureCommandWithContext.execute(AddFeatureCommandWithContext.java:76) at org.eclipse.graphiti.internal.command.GFPreparableCommand.doExecute(GFPreparableCommand.java:37) at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135) at org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl.execute(GFWorkspaceCommandStackImpl.java:52) at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219) at org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl.execute(GFWorkspaceCommandStackImpl.java:39) at org.eclipse.graphiti.internal.command.CommandExec.executeCommand(CommandExec.java:74) at org.eclipse.graphiti.features.impl.AbstractFeatureProvider.addIfPossible(AbstractFeatureProvider.java:338) at mypackage.CreateConnectionFeature.create(CreateConnectionFeature.java:86)
Created attachment 195842 [details] mylyn/context/zip
eclipse runtime assertions added, runtime exception with descriptive message will be thrown
Part of Graphiti Indigo 0.8.0