Skip to content
Snippets Groups Projects
Commit 08499b83 authored by Dongyue Mou's avatar Dongyue Mou
Browse files

bug fix for null pointer exception if service.compose is called directly

parent 9ac859e2
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ package org.fortiss.tooling.kernel.internal;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.ToolingKernelActivator;
import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
......@@ -27,6 +28,7 @@ import org.fortiss.tooling.kernel.model.ILibraryElementReference;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.service.base.EObjectAwareServiceBase;
import org.fortiss.tooling.kernel.utils.LoggingUtils;
/**
* This class implements the {@link IElementCompositorService} interface.
......@@ -34,7 +36,7 @@ import org.fortiss.tooling.kernel.service.base.EObjectAwareServiceBase;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 60984ED04677CEB022C01A46081438E4
* @ConQAT.Rating YELLOW Hash: 92E1A4E58E91DC08258B83B53E3034D2
*/
public final class ElementCompositorService extends
EObjectAwareServiceBase<IElementCompositor<EObject>> implements IElementCompositorService {
......@@ -64,6 +66,12 @@ public final class ElementCompositorService extends
public boolean compose(EObject container, EObject element, IElementCompositionContext context) {
IElementCompositor<EObject> compositor =
findWorkingCompositor(container, element, context, false);
if(compositor == null) {
LoggingUtils.error(ToolingKernelActivator.getDefault(), String.format(
"Can not find compositor for container %s and element %s",
container.getClass(), element.getClass()));
return false;
}
IPersistencyService.INSTANCE.getTopLevelElementFor(container).prepareIDs(element);
return compositor.compose(container, element, context);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment