Program: 141962
Project: 141962
Buggy source:
private void formEntry(long formDefId,FormRecord r,String headerTitle,boolean isRestartAfterSessionExpiration){
  Logger.log(LogTypes.TYPE_FORM_ENTRY,"String_Node_Str" + r.getFormNamespace());
  FormLoaderTask.iif=new AndroidInstanceInitializer(CommCareApplication.instance().getCurrentSession());
  Intent i=new Intent(getApplicationContext(),FormEntryActivity.class);
  i.setAction(Intent.ACTION_EDIT);
  i.putExtra(FormEntryInstanceState.KEY_INSTANCEDESTINATION,CommCareApplication.instance().getCurrentApp().fsPath((GlobalConstants.FILE_CC_FORMS)));
  if (r.getInstanceId() != -1) {
    i.putExtra(FormEntryActivity.KEY_INSTANCE_ID,r.getInstanceId());
  }
 else {
    i.putExtra(FormEntryActivity.KEY_FORM_DEF_ID,formDefId);
  }
  i.putExtra(FormEntryActivity.KEY_RESIZING_ENABLED,HiddenPreferences.getResizeMethod());
  i.putExtra(FormEntryActivity.KEY_INCOMPLETE_ENABLED,HiddenPreferences.isIncompleteFormsEnabled());
  i.putExtra(FormEntryActivity.KEY_AES_STORAGE_KEY,Base64.encodeToString(r.getAesKey(),Base64.DEFAULT));
  i.putExtra(FormEntrySessionWrapper.KEY_RECORD_FORM_ENTRY_SESSION,DeveloperPreferences.isSessionSavingEnabled());
  i.putExtra(FormEntryActivity.KEY_IS_RESTART_AFTER_EXPIRATION,isRestartAfterSessionExpiration);
  if (headerTitle != null) {
    i.putExtra(FormEntryActivity.KEY_HEADER_STRING,headerTitle);
  }
  if (isRestoringSession) {
    isRestoringSession=false;
    SharedPreferences prefs=CommCareApplication.instance().getCurrentApp().getAppPreferences();
    String formEntrySession=prefs.getString(DevSessionRestorer.CURRENT_FORM_ENTRY_SESSION,"String_Node_Str");
    if (!"String_Node_Str".equals(formEntrySession)) {
      i.putExtra(FormEntrySessionWrapper.KEY_FORM_ENTRY_SESSION,formEntrySession);
    }
  }
  startActivityForResult(i,MODEL_RESULT);
}

Fixed version (ground truth):
private void formEntry(int formDefId,FormRecord r,String headerTitle,boolean isRestartAfterSessionExpiration){
  Logger.log(LogTypes.TYPE_FORM_ENTRY,"String_Node_Str" + r.getFormNamespace());
  FormLoaderTask.iif=new AndroidInstanceInitializer(CommCareApplication.instance().getCurrentSession());
  Intent i=new Intent(getApplicationContext(),FormEntryActivity.class);
  i.setAction(Intent.ACTION_EDIT);
  i.putExtra(FormEntryInstanceState.KEY_INSTANCEDESTINATION,CommCareApplication.instance().getCurrentApp().fsPath((GlobalConstants.FILE_CC_FORMS)));
  if (r.getInstanceId() != -1) {
    i.putExtra(FormEntryActivity.KEY_INSTANCE_ID,r.getInstanceId());
  }
 else {
    i.putExtra(FormEntryActivity.KEY_FORM_DEF_ID,formDefId);
  }
  i.putExtra(FormEntryActivity.KEY_RESIZING_ENABLED,HiddenPreferences.getResizeMethod());
  i.putExtra(FormEntryActivity.KEY_INCOMPLETE_ENABLED,HiddenPreferences.isIncompleteFormsEnabled());
  i.putExtra(FormEntryActivity.KEY_AES_STORAGE_KEY,Base64.encodeToString(r.getAesKey(),Base64.DEFAULT));
  i.putExtra(FormEntrySessionWrapper.KEY_RECORD_FORM_ENTRY_SESSION,DeveloperPreferences.isSessionSavingEnabled());
  i.putExtra(FormEntryActivity.KEY_IS_RESTART_AFTER_EXPIRATION,isRestartAfterSessionExpiration);
  if (headerTitle != null) {
    i.putExtra(FormEntryActivity.KEY_HEADER_STRING,headerTitle);
  }
  if (isRestoringSession) {
    isRestoringSession=false;
    SharedPreferences prefs=CommCareApplication.instance().getCurrentApp().getAppPreferences();
    String formEntrySession=prefs.getString(DevSessionRestorer.CURRENT_FORM_ENTRY_SESSION,"String_Node_Str");
    if (!"String_Node_Str".equals(formEntrySession)) {
      i.putExtra(FormEntrySessionWrapper.KEY_FORM_ENTRY_SESSION,formEntrySession);
    }
  }
  startActivityForResult(i,MODEL_RESULT);
}