Commit 832cfefe authored by Philippe Merle's avatar Philippe Merle
Browse files

Corrected how membrane.controllerDesc() is checked.

Avoid a NullPointerException when controllerDesc() has its default value.
parent 5e08d5f3
......@@ -33,6 +33,7 @@ import java.util.List;
import org.objectweb.fractal.api.type.ComponentType;
import org.objectweb.fractal.fraclet.extensions.Membrane;
import org.objectweb.fractal.fraclet.types.Constants;
import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.conf.JDKLevel;
import org.objectweb.fractal.juliac.conf.JuliacConfig;
......@@ -358,7 +359,7 @@ public class JuliacComponent
// The content class is annotated with @Membrane.
// Is its 'controllerDesc' attribute defined?
clazz = membrane.controllerDesc();
if(clazz != null) {
if( ! clazz.equals(Constants.class) ) {
// Yes, then this controlledDesc is annotated with @Membrane.
membrane = clazz.getAnnotation(Membrane.class);
// Add to Juliac a binding between the membrane name and the membrane class
......
......@@ -37,6 +37,7 @@ import org.objectweb.fractal.api.factory.GenericFactory;
import org.objectweb.fractal.api.factory.InstantiationException;
import org.objectweb.fractal.api.type.ComponentType;
import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.fraclet.types.Constants;
import org.objectweb.fractal.fraclet.extensions.Membrane;
import org.objectweb.fractal.util.Fractal;
......@@ -252,9 +253,10 @@ public class ComponentFactoryImpl
if(membrane != null) {
// The content class is annotated with @Membrane.
// Is its 'controllerDesc' attribute defined?
if(membrane.controllerDesc() != null) {
Class<?> controllerDesc = membrane.controllerDesc();
if( ! controllerDesc.equals(Constants.class) ) {
// Yes, then this controlledDesc is annotated with @Membrane.
membrane = membrane.controllerDesc().getAnnotation(Membrane.class);
membrane = controllerDesc.getAnnotation(Membrane.class);
}
// Change the membraneDesc to use to instantiate the component.
membraneDesc = membrane.desc();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment