Program: 145356
Project: 145356
Buggy source:
private void workflow(IActivity lastActivity,String returnCode,Hashtable returnVals){
  if (stack.size() != 0) {
    IActivity activity=stack.pop();
    this.currentActivity=activity;
    activity.resume(context);
  }
 else {
    if (lastActivity == this.splashScreen) {
      currentActivity=formListActivity;
      this.formListActivity.start(context);
    }
    if (lastActivity == this.modelActivity) {
      if (returnCode == Constants.ACTIVITY_NEEDS_RESOLUTION) {
        Object returnVal=returnVals.get(ModelListActivity.returnKey);
        if (returnVal == ModelListActivity.CMD_MSGS) {
          TransportContext msgContext=new TransportContext(context);
          msgContext.setRequestedTask(TransportContext.MESSAGE_VIEW);
          currentActivity=formTransport;
          formTransport.start(msgContext);
        }
      }
      if (returnCode == Constants.ACTIVITY_COMPLETE) {
        Object returnVal=returnVals.get(ModelListActivity.returnKey);
        if (returnVal == ModelListActivity.CMD_EDIT) {
          FormDef form=(FormDef)returnVals.get("String_Node_Str");
          FormData data=(FormData)returnVals.get("String_Node_Str");
          FormEntryContext newContext=new FormEntryContext(context);
          newContext.setFormID(form.getId());
          newContext.setInstanceID(data.getRecordId());
          currentActivity=this.modelActivity;
          this.modelActivity.start(newContext);
        }
        if (returnVal == ModelListActivity.CMD_SEND) {
          FormData data=(FormData)returnVals.get("String_Node_Str");
          formTransport.setData(data);
          TransportContext msgContext=new TransportContext(context);
          msgContext.setRequestedTask(TransportContext.SEND_DATA);
          currentActivity=formTransport;
          formTransport.start(msgContext);
        }
      }
    }
    if (lastActivity == this.formTransport) {
      if (returnCode == Constants.ACTIVITY_NEEDS_RESOLUTION) {
        String returnVal=(String)returnVals.get(FormTransportActivity.RETURN_KEY);
        if (returnVal == FormTransportActivity.VIEW_MODELS) {
          currentActivity=this.modelActivity;
          this.modelActivity.start(context);
        }
      }
      if (returnCode == Constants.ACTIVITY_COMPLETE) {
      }
    }
    if (lastActivity == this.formListActivity) {
      if (returnCode == Constants.ACTIVITY_NEEDS_RESOLUTION) {
        String returnVal=(String)returnVals.get(FormListActivity.COMMAND_KEY);
        if (returnVal == Commands.CMD_VIEW_DATA) {
          currentActivity=this.modelActivity;
          this.modelActivity.start(context);
        }
        if (returnVal == Commands.CMD_SETTINGS) {
          currentActivity=this.propertyActivity;
          this.propertyActivity.start(context);
        }
        if (returnVal == Commands.CMD_SELECT_XFORM) {
          FormEntryContext newContext=new FormEntryContext(context);
          newContext.setFormID(((Integer)returnVals.get(FormListActivity.FORM_ID_KEY)).intValue());
          currentActivity=this.entryActivity;
          this.entryActivity.start(newContext);
        }
      }
      if (returnCode == Constants.ACTIVITY_COMPLETE) {
      }
    }
    if (currentActivity == lastActivity) {
      currentActivity=formListActivity;
      formListActivity.start(context);
    }
  }
}

Fixed version (ground truth):
private void workflow(IActivity lastActivity,String returnCode,Hashtable returnVals){
  if (stack.size() != 0) {
    IActivity activity=stack.pop();
    this.currentActivity=activity;
    activity.resume(context);
  }
 else {
    if (lastActivity == this.splashScreen) {
      currentActivity=formListActivity;
      this.formListActivity.start(context);
    }
    if (lastActivity == this.modelActivity) {
      if (returnCode == Constants.ACTIVITY_NEEDS_RESOLUTION) {
        Object returnVal=returnVals.get(ModelListActivity.returnKey);
        if (returnVal == ModelListActivity.CMD_MSGS) {
          TransportContext msgContext=new TransportContext(context);
          msgContext.setRequestedTask(TransportContext.MESSAGE_VIEW);
          currentActivity=formTransport;
          formTransport.start(msgContext);
        }
      }
      if (returnCode == Constants.ACTIVITY_COMPLETE) {
        Object returnVal=returnVals.get(ModelListActivity.returnKey);
        if (returnVal == ModelListActivity.CMD_EDIT) {
          FormDef form=(FormDef)returnVals.get("String_Node_Str");
          FormData data=(FormData)returnVals.get("String_Node_Str");
          FormEntryContext newContext=new FormEntryContext(context);
          newContext.setFormID(form.getID());
          newContext.setInstanceID(data.getRecordId());
          currentActivity=this.modelActivity;
          this.modelActivity.start(newContext);
        }
        if (returnVal == ModelListActivity.CMD_SEND) {
          FormData data=(FormData)returnVals.get("String_Node_Str");
          formTransport.setData(data);
          TransportContext msgContext=new TransportContext(context);
          msgContext.setRequestedTask(TransportContext.SEND_DATA);
          currentActivity=formTransport;
          formTransport.start(msgContext);
        }
      }
    }
    if (lastActivity == this.formTransport) {
      if (returnCode == Constants.ACTIVITY_NEEDS_RESOLUTION) {
        String returnVal=(String)returnVals.get(FormTransportActivity.RETURN_KEY);
        if (returnVal == FormTransportActivity.VIEW_MODELS) {
          currentActivity=this.modelActivity;
          this.modelActivity.start(context);
        }
      }
      if (returnCode == Constants.ACTIVITY_COMPLETE) {
      }
    }
    if (lastActivity == this.formListActivity) {
      if (returnCode == Constants.ACTIVITY_NEEDS_RESOLUTION) {
        String returnVal=(String)returnVals.get(FormListActivity.COMMAND_KEY);
        if (returnVal == Commands.CMD_VIEW_DATA) {
          currentActivity=this.modelActivity;
          this.modelActivity.start(context);
        }
        if (returnVal == Commands.CMD_SETTINGS) {
          currentActivity=this.propertyActivity;
          this.propertyActivity.start(context);
        }
        if (returnVal == Commands.CMD_SELECT_XFORM) {
          FormEntryContext newContext=new FormEntryContext(context);
          newContext.setFormID(((Integer)returnVals.get(FormListActivity.FORM_ID_KEY)).intValue());
          currentActivity=this.entryActivity;
          this.entryActivity.start(newContext);
        }
      }
      if (returnCode == Constants.ACTIVITY_COMPLETE) {
      }
    }
    if (currentActivity == lastActivity) {
      currentActivity=formListActivity;
      formListActivity.start(context);
    }
  }
}