Program: 25306
Project: 25306
Buggy source:
@Override public Object invokeFinal(Object iContent,Object[] params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
  Object selectedValue=getSingleSelection(iContent);
  SchemaClass clazz=Roma.schema().getSchemaClass(EntityHelper.getEntityObject(selectedValue).getClass());
  SchemaClass selectedValueClass=Roma.schema().getSchemaClass(selectedValue.getClass());
  Object domainInstance;
  if (!selectedValueClass.equals(clazz)) {
    if (!selectedValueClass.isAssignableAs(clazz)) {
      domainInstance=EntityHelper.getEntityObject(selectedValue);
    }
 else     domainInstance=selectedValue;
  }
 else {
    domainInstance=selectedValue;
  }
  SchemaClass formClass=CRUDHelper.getCRUDInstance(EntityHelper.getEntityObject(selectedValue).getClass());
  Object formInstance;
  if (formClass == null)   formInstance=domainInstance;
 else {
    try {
      formInstance=EntityHelper.createObject(domainInstance,formClass);
    }
 catch (    InstantiationException e) {
      throw new RuntimeException(e);
    }
  }
  if (formInstance instanceof CRUDInstance) {
    ((CRUDInstance<?>)formInstance).setMode(getOpenMode());
  }
  if (formInstance instanceof Bindable)   ((Bindable)formInstance).setSource(iContent,field.getName());
  if (formClass == null) {
    final InstanceWrapper instanceWrapper=new InstanceWrapper(iContent,field,formInstance,getOpenMode());
    Roma.aspect(FlowAspect.class).forward(instanceWrapper,"String_Node_Str");
  }
 else   Roma.aspect(FlowAspect.class).forward(formInstance,"String_Node_Str");
  return null;
}

Fixed version (ground truth):
@Override public Object invokeFinal(Object iContent,Object[] params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
  Object selectedValue=getSingleSelection(iContent);
  if (selectedValue != null) {
    SchemaClass clazz=Roma.schema().getSchemaClass(EntityHelper.getEntityObject(selectedValue).getClass());
    SchemaClass selectedValueClass=Roma.schema().getSchemaClass(selectedValue.getClass());
    Object domainInstance;
    if (!selectedValueClass.equals(clazz)) {
      if (!selectedValueClass.isAssignableAs(clazz)) {
        domainInstance=EntityHelper.getEntityObject(selectedValue);
      }
 else       domainInstance=selectedValue;
    }
 else {
      domainInstance=selectedValue;
    }
    SchemaClass formClass=CRUDHelper.getCRUDInstance(EntityHelper.getEntityObject(selectedValue).getClass());
    Object formInstance;
    if (formClass == null)     formInstance=domainInstance;
 else {
      try {
        formInstance=EntityHelper.createObject(domainInstance,formClass);
      }
 catch (      InstantiationException e) {
        throw new RuntimeException(e);
      }
    }
    if (formInstance instanceof CRUDInstance) {
      ((CRUDInstance<?>)formInstance).setMode(getOpenMode());
    }
    if (formInstance instanceof Bindable)     ((Bindable)formInstance).setSource(iContent,field.getName());
    if (formClass == null) {
      final InstanceWrapper instanceWrapper=new InstanceWrapper(iContent,field,formInstance,getOpenMode());
      Roma.aspect(FlowAspect.class).forward(instanceWrapper,"String_Node_Str");
    }
 else     Roma.aspect(FlowAspect.class).forward(formInstance,"String_Node_Str");
  }
  return null;
}