nus-yam/ex-repair huggingface dataset:
Program: 142111
Project: 142111
Buggy source:
public void syncData(final CommCareActivity activity,final boolean formsToSend,final boolean userTriggeredSync,String server,String username,String password){
  DataPullTask<PullTaskReceiver> mDataPullTask=new DataPullTask<PullTaskReceiver>(username,password,server,activity){
    @Override protected void deliverResult(    PullTaskReceiver receiver,    ResultAndError<PullTaskResult> resultAndErrorMessage){
      receiver.handlePullTaskResult(resultAndErrorMessage,userTriggeredSync,formsToSend);
    }
    @Override protected void deliverUpdate(    PullTaskReceiver receiver,    Integer... update){
      receiver.handlePullTaskUpdate(update);
    }
    @Override protected void deliverError(    PullTaskReceiver receiver,    Exception e){
      receiver.handlePullTaskError(e);
    }
  }
;
  mDataPullTask.connect(activity);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    mDataPullTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
  }
 else {
    mDataPullTask.execute();
  }
}

Fixed version (ground truth):
public <I extends CommCareActivity & PullTaskReceiver>void syncData(final I activity,final boolean formsToSend,final boolean userTriggeredSync,String server,String username,String password){
  DataPullTask<PullTaskReceiver> mDataPullTask=new DataPullTask<PullTaskReceiver>(username,password,server,activity){
    @Override protected void deliverResult(    PullTaskReceiver receiver,    ResultAndError<PullTaskResult> resultAndErrorMessage){
      receiver.handlePullTaskResult(resultAndErrorMessage,userTriggeredSync,formsToSend);
    }
    @Override protected void deliverUpdate(    PullTaskReceiver receiver,    Integer... update){
      receiver.handlePullTaskUpdate(update);
    }
    @Override protected void deliverError(    PullTaskReceiver receiver,    Exception e){
      receiver.handlePullTaskError(e);
    }
  }
;
  mDataPullTask.connect(activity);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    mDataPullTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
  }
 else {
    mDataPullTask.execute();
  }
}
Program: 142112
Project: 142112
Buggy source:
public void syncDataForLoggedInUser(final CommCareHomeActivity activity,final boolean formsToSend,final boolean userTriggeredSync){
  User u;
  try {
    u=CommCareApplication._().getSession().getLoggedInUser();
  }
 catch (  SessionUnavailableException sue) {
    return;
  }
  if (User.TYPE_DEMO.equals(u.getUserType())) {
    if (userTriggeredSync) {
      if (formsToSend) {
        activity.displayMessage(Localization.get("String_Node_Str"),true,true);
      }
 else {
        activity.displayMessage(Localization.get("String_Node_Str"),true,true);
      }
    }
    return;
  }
  SharedPreferences prefs=CommCareApplication._().getCurrentApp().getAppPreferences();
  syncData(activity,formsToSend,userTriggeredSync,u.getUsername(),u.getCachedPwd(),prefs.getString(CommCarePreferences.PREFS_DATA_SERVER_KEY,activity.getString(R.string.ota_restore_url)));
}

Fixed version (ground truth):
public void syncDataForLoggedInUser(final CommCareHomeActivity activity,final boolean formsToSend,final boolean userTriggeredSync){
  User u;
  try {
    u=CommCareApplication._().getSession().getLoggedInUser();
  }
 catch (  SessionUnavailableException sue) {
    return;
  }
  if (User.TYPE_DEMO.equals(u.getUserType())) {
    if (userTriggeredSync) {
      if (formsToSend) {
        activity.displayMessage(Localization.get("String_Node_Str"),true,true);
      }
 else {
        activity.displayMessage(Localization.get("String_Node_Str"),true,true);
      }
    }
    return;
  }
  SharedPreferences prefs=CommCareApplication._().getCurrentApp().getAppPreferences();
  syncData(activity,formsToSend,userTriggeredSync,prefs.getString(CommCarePreferences.PREFS_DATA_SERVER_KEY,activity.getString(R.string.ota_restore_url)),u.getUsername(),u.getCachedPwd());
}
Program: 142113
Project: 142113
Buggy source:
private void saveInlineVideoState(){
  for (int i=0; i < questionsView.getWidgets().size(); i++) {
    QuestionWidget q=questionsView.getWidgets().get(i);
    if (q.findViewById(MediaLayout.INLINE_VIDEO_PANE_ID) != null) {
      VideoView inlineVideo=(VideoView)q.findViewById(MediaLayout.INLINE_VIDEO_PANE_ID);
      if (inlineVideo.isPlaying()) {
        indexOfWidgetWithVideoPlaying=i;
        positionOfVideoProgress=inlineVideo.getCurrentPosition();
        return;
      }
    }
  }
}

Fixed version (ground truth):
private void saveInlineVideoState(){
  if (questionsView != null) {
    for (int i=0; i < questionsView.getWidgets().size(); i++) {
      QuestionWidget q=questionsView.getWidgets().get(i);
      if (q.findViewById(MediaLayout.INLINE_VIDEO_PANE_ID) != null) {
        VideoView inlineVideo=(VideoView)q.findViewById(MediaLayout.INLINE_VIDEO_PANE_ID);
        if (inlineVideo.isPlaying()) {
          indexOfWidgetWithVideoPlaying=i;
          positionOfVideoProgress=inlineVideo.getCurrentPosition();
          return;
        }
      }
    }
  }
}
Program: 142114
Project: 142114
Buggy source:
private void handleFormLoadCompletion(FormController fc){
  if (GeoUtils.ACTION_CHECK_GPS_ENABLED.equals(locationRecieverErrorAction)) {
    handleNoGpsBroadcast();
  }
 else   if (PollSensorAction.XPATH_ERROR_ACTION.equals(locationRecieverErrorAction)) {
    handleXpathErrorBroadcast();
  }
  mFormController=fc;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    invalidateOptionsMenu();
  }
  registerSessionFormSaveCallback();
  if (mInstancePath == null) {
    String time=new SimpleDateFormat("String_Node_Str").format(Calendar.getInstance().getTime());
    String file=mFormPath.substring(mFormPath.lastIndexOf('/') + 1,mFormPath.lastIndexOf('.'));
    String path=mInstanceDestination + file + "String_Node_Str"+ time;
    if (FileUtil.createFolder(path)) {
      mInstancePath=path + "String_Node_Str" + file+ "String_Node_Str"+ time+ "String_Node_Str";
    }
  }
 else {
    Intent i=new Intent(FormEntryActivity.this,FormHierarchyActivity.class);
    startActivityForResult(i,HIERARCHY_ACTIVITY_FIRST_START);
    return;
  }
  reportFormEntry();
  try {
    FormEntrySessionReplayer.tryReplayingFormEntry(mFormController.getFormEntryController(),formEntryRestoreSession);
  }
 catch (  FormEntrySessionReplayer.ReplayError e) {
    UserfacingErrorHandling.createErrorDialog(this,e.getMessage(),EXIT);
  }
  refreshCurrentView();
  FormNavigationUI.updateNavigationCues(this,mFormController,questionsView);
}

Fixed version (ground truth):
private void handleFormLoadCompletion(FormController fc){
  if (GeoUtils.ACTION_CHECK_GPS_ENABLED.equals(locationRecieverErrorAction)) {
    handleNoGpsBroadcast();
  }
 else   if (PollSensorAction.XPATH_ERROR_ACTION.equals(locationRecieverErrorAction)) {
    handleXpathErrorBroadcast();
  }
  mFormController=fc;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    invalidateOptionsMenu();
  }
  registerSessionFormSaveCallback();
  if (mInstancePath == null) {
    String time=new SimpleDateFormat("String_Node_Str").format(Calendar.getInstance().getTime());
    String file=mFormPath.substring(mFormPath.lastIndexOf('/') + 1,mFormPath.lastIndexOf('.'));
    String path=mInstanceDestination + file + "String_Node_Str"+ time;
    if (FileUtil.createFolder(path)) {
      mInstancePath=path + "String_Node_Str" + file+ "String_Node_Str"+ time+ "String_Node_Str";
    }
  }
 else {
    Intent i=new Intent(this,FormHierarchyActivity.class);
    startActivityForResult(i,HIERARCHY_ACTIVITY_FIRST_START);
    return;
  }
  reportFormEntry();
  try {
    FormEntrySessionReplayer.tryReplayingFormEntry(mFormController.getFormEntryController(),formEntryRestoreSession);
  }
 catch (  FormEntrySessionReplayer.ReplayError e) {
    UserfacingErrorHandling.createErrorDialog(this,e.getMessage(),EXIT);
  }
  refreshCurrentView();
  FormNavigationUI.updateNavigationCues(this,mFormController,questionsView);
}
Program: 142116
Project: 142116
Buggy source:
private void setupUI(){
  buildPromptUI();
  queryButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      answerPrompts();
      makeQueryRequest();
    }
  }
);
}

Fixed version (ground truth):
private void setupUI(){
  buildPromptUI();
  queryButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      answerPrompts();
      makeQueryRequest();
    }
  }
);
  if (inErrorState) {
    enterErrorState();
  }
}
Program: 142118
Project: 142118
Buggy source:
@Test public void reloadQueryActivityStateTest(){
  AndroidSessionWrapper sessionWrapper=CommCareApplication._().getCurrentSessionWrapper();
  CommCareSession session=sessionWrapper.getSession();
  session.setCommand("String_Node_Str");
  Intent queryActivityIntent=new Intent(RuntimeEnvironment.application,QueryRequestActivity.class);
  ActivityController<QueryRequestActivity> controller=Robolectric.buildActivity(QueryRequestActivity.class).withIntent(queryActivityIntent).create().start().resume();
  QueryRequestActivity queryRequestActivity=controller.get();
  LinearLayout promptsLayout=(LinearLayout)queryRequestActivity.findViewById(R.id.query_prompts);
  EditText patientId=(EditText)promptsLayout.getChildAt(1);
  patientId.setText("String_Node_Str");
  Bundle savedInstanceState=new Bundle();
  controller.saveInstanceState(savedInstanceState);
  controller.resume();
  queryRequestActivity=Robolectric.buildActivity(QueryRequestActivity.class).withIntent(queryActivityIntent).create(savedInstanceState).start().resume().get();
  promptsLayout=(LinearLayout)queryRequestActivity.findViewById(R.id.query_prompts);
  patientId=(EditText)promptsLayout.getChildAt(1);
  assertEquals("String_Node_Str",patientId.getText().toString());
  patientId=(EditText)promptsLayout.getChildAt(3);
  assertEquals("String_Node_Str",patientId.getText().toString());
}

Fixed version (ground truth):
@Test public void reloadQueryActivityStateTest(){
  AndroidSessionWrapper sessionWrapper=CommCareApplication._().getCurrentSessionWrapper();
  CommCareSession session=sessionWrapper.getSession();
  session.setCommand("String_Node_Str");
  Intent queryActivityIntent=new Intent(RuntimeEnvironment.application,QueryRequestActivity.class);
  ActivityController<QueryRequestActivity> controller=Robolectric.buildActivity(QueryRequestActivity.class).withIntent(queryActivityIntent).create().start().resume();
  QueryRequestActivity queryRequestActivity=controller.get();
  LinearLayout promptsLayout=(LinearLayout)queryRequestActivity.findViewById(R.id.query_prompts);
  EditText patientId=(EditText)promptsLayout.getChildAt(1);
  patientId.setText("String_Node_Str");
  Bundle savedInstanceState=new Bundle();
  controller.saveInstanceState(savedInstanceState);
  queryRequestActivity=Robolectric.buildActivity(QueryRequestActivity.class).withIntent(queryActivityIntent).create(savedInstanceState).start().resume().get();
  promptsLayout=(LinearLayout)queryRequestActivity.findViewById(R.id.query_prompts);
  patientId=(EditText)promptsLayout.getChildAt(1);
  assertEquals("String_Node_Str",patientId.getText().toString());
  patientId=(EditText)promptsLayout.getChildAt(3);
  assertEquals("String_Node_Str",patientId.getText().toString());
}
Program: 142119
Project: 142119
Buggy source:
@Test public void emptyFileSelectionTest(){
  MultimediaInflaterActivity multimediaInflaterActivity=Robolectric.buildActivity(MultimediaInflaterActivity.class).create().start().resume().get();
  ShadowActivity shadowActivity=Shadows.shadowOf(multimediaInflaterActivity);
  Intent fileSelectIntent=new Intent(Intent.ACTION_GET_CONTENT);
  fileSelectIntent.setType("String_Node_Str");
  shadowActivity.receiveResult(fileSelectIntent,MultimediaInflaterActivity.REQUEST_FILE_LOCATION,new Intent());
}

Fixed version (ground truth):
/** 
 * Ensure user sees invalid path toast when the file browser doesn't return a path uri
 */
@Test public void emptyFileSelectionTest(){
  MultimediaInflaterActivity multimediaInflaterActivity=Robolectric.buildActivity(MultimediaInflaterActivity.class).create().start().resume().get();
  ImageButton selectFileButton=(ImageButton)multimediaInflaterActivity.findViewById(R.id.screen_multimedia_inflater_filefetch);
  selectFileButton.performClick();
  Intent fileSelectIntent=new Intent(Intent.ACTION_GET_CONTENT);
  fileSelectIntent.setType("String_Node_Str");
  Intent emptyFileSelectResult=new Intent();
  ShadowActivity shadowActivity=Shadows.shadowOf(multimediaInflaterActivity);
  shadowActivity.receiveResult(fileSelectIntent,Activity.RESULT_OK,emptyFileSelectResult);
  Assert.assertEquals(Localization.get("String_Node_Str"),ShadowToast.getTextOfLatestToast());
}
Program: 142120
Project: 142120
Buggy source:
@Before public void setup(){
  TestAppInstaller.initInstallAndLogin("String_Node_Str","String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Before public void setup(){
  TestAppInstaller.installApp("String_Node_Str");
}
Program: 142121
Project: 142121
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent intent){
switch (requestCode) {
case BARCODE_FETCH:
    processBarcodeFetch(resultCode,intent);
  break;
case CALLOUT:
processCalloutResult(resultCode,intent);
break;
case CONFIRM_SELECT:
resuming=true;
if (resultCode == RESULT_OK && !mViewMode) {
returnWithResult(intent);
}
 else {
if (mResultIsMap) {
mResultIsMap=false;
Intent i=new Intent(this,EntityMapActivity.class);
this.startActivityForResult(i,MAP_SELECT);
return;
}
if (inAwesomeMode) {
TreeReference r=SerializationUtil.deserializeFromIntent(intent,EntityDetailActivity.CONTEXT_REFERENCE,TreeReference.class);
if (r != null && adapter != null) {
this.displayReferenceAwesome(r,adapter.getPosition(r));
updateSelectedItem(r,true);
}
AudioController.INSTANCE.releaseCurrentMediaEntity();
}
}
break;
case MAP_SELECT:
if (resultCode == RESULT_OK) {
TreeReference r=SerializationUtil.deserializeFromIntent(intent,EntityDetailActivity.CONTEXT_REFERENCE,TreeReference.class);
if (inAwesomeMode) {
this.displayReferenceAwesome(r,adapter.getPosition(r));
}
 else {
Intent i=EntityDetailUtils.getDetailIntent(getApplicationContext(),r,null,selectDatum,asw);
if (mNoDetailMode) {
returnWithResult(i);
}
 else {
mResultIsMap=true;
i.putExtra("String_Node_Str",adapter.getPosition(r));
startActivityForResult(i,CONFIRM_SELECT);
}
}
}
 else {
refreshView();
}
break;
default :
super.onActivityResult(requestCode,resultCode,intent);
}
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent intent){
switch (requestCode) {
case BARCODE_FETCH:
    processBarcodeFetch(resultCode,intent);
  break;
case CALLOUT:
processCalloutResult(resultCode,intent);
break;
case CONFIRM_SELECT:
resuming=true;
isStartingDetailActivity=false;
if (resultCode == RESULT_OK && !mViewMode) {
returnWithResult(intent);
}
 else {
if (mResultIsMap) {
mResultIsMap=false;
Intent i=new Intent(this,EntityMapActivity.class);
this.startActivityForResult(i,MAP_SELECT);
return;
}
if (inAwesomeMode) {
TreeReference r=SerializationUtil.deserializeFromIntent(intent,EntityDetailActivity.CONTEXT_REFERENCE,TreeReference.class);
if (r != null && adapter != null) {
this.displayReferenceAwesome(r,adapter.getPosition(r));
updateSelectedItem(r,true);
}
AudioController.INSTANCE.releaseCurrentMediaEntity();
}
}
break;
case MAP_SELECT:
if (resultCode == RESULT_OK) {
TreeReference r=SerializationUtil.deserializeFromIntent(intent,EntityDetailActivity.CONTEXT_REFERENCE,TreeReference.class);
if (inAwesomeMode) {
this.displayReferenceAwesome(r,adapter.getPosition(r));
}
 else {
Intent i=EntityDetailUtils.getDetailIntent(getApplicationContext(),r,null,selectDatum,asw);
if (mNoDetailMode) {
returnWithResult(i);
}
 else {
mResultIsMap=true;
i.putExtra("String_Node_Str",adapter.getPosition(r));
startActivityForResult(i,CONFIRM_SELECT);
}
}
}
 else {
refreshView();
}
break;
default :
super.onActivityResult(requestCode,resultCode,intent);
}
}
Program: 142122
Project: 142122
Buggy source:
/** 
 * Returns the hierarchy of groups to which the question belongs.
 */
private SpannableStringBuilder deriveGroupText(FormEntryCaption[] groups){
  SpannableStringBuilder s=new SpannableStringBuilder("String_Node_Str");
  String t;
  String m;
  int i;
  for (  FormEntryCaption g : groups) {
    i=g.getMultiplicity() + 1;
    t=g.getLongText();
    m=g.getMarkdownText();
    if (m != null) {
      Spannable markdownSpannable=MarkupUtil.returnMarkdown(getContext(),m);
      s.append(markdownSpannable);
    }
 else     if (t != null) {
      s.append(t);
    }
    if (g.repeats() && i > 0) {
      s.append("String_Node_Str").append(String.valueOf(i)).append("String_Node_Str");
    }
    s.append("String_Node_Str");
  }
  if (s.length() > 0) {
    s.delete(s.length() - 2,s.length());
  }
  return s;
}

Fixed version (ground truth):
/** 
 * Returns the hierarchy of groups to which the question belongs.
 */
private SpannableStringBuilder deriveGroupText(FormEntryCaption[] groups){
  SpannableStringBuilder s=new SpannableStringBuilder("String_Node_Str");
  String t;
  String m;
  int i;
  for (  FormEntryCaption g : groups) {
    i=g.getMultiplicity() + 1;
    t=g.getLongText();
    m=g.getMarkdownText();
    if (m != null) {
      Spannable markdownSpannable=MarkupUtil.returnMarkdown(getContext(),m);
      s.append(markdownSpannable);
    }
 else     if (t != null && !t.trim().equals("String_Node_Str")) {
      s.append(t);
    }
 else {
      continue;
    }
    if (g.repeats() && i > 0) {
      s.append("String_Node_Str").append(String.valueOf(i)).append("String_Node_Str");
    }
    s.append("String_Node_Str");
  }
  if (s.length() > 0) {
    s.delete(s.length() - 2,s.length());
  }
  return s;
}
Program: 142123
Project: 142123
Buggy source:
/** 
 * Returns the hierarchy of groups to which the question belongs.
 */
private SpannableStringBuilder deriveGroupText(FormEntryCaption[] groups){
  SpannableStringBuilder s=new SpannableStringBuilder("String_Node_Str");
  String t;
  String m;
  int i;
  for (  FormEntryCaption g : groups) {
    i=g.getMultiplicity() + 1;
    t=g.getLongText();
    m=g.getMarkdownText();
    if (m != null) {
      Spannable markdownSpannable=MarkupUtil.returnMarkdown(getContext(),m);
      s.append(markdownSpannable);
    }
 else     if (t != null) {
      s.append(t);
    }
    if (g.repeats() && i > 0) {
      s.append("String_Node_Str").append(String.valueOf(i)).append("String_Node_Str");
    }
    s.append("String_Node_Str");
  }
  if (s.length() > 0) {
    s.delete(s.length() - 2,s.length());
  }
  return s;
}

Fixed version (ground truth):
/** 
 * Returns the hierarchy of groups to which the question belongs.
 */
private SpannableStringBuilder deriveGroupText(FormEntryCaption[] groups){
  SpannableStringBuilder s=new SpannableStringBuilder("String_Node_Str");
  String t;
  String m;
  int i;
  for (  FormEntryCaption g : groups) {
    i=g.getMultiplicity() + 1;
    t=g.getLongText();
    m=g.getMarkdownText();
    if (m != null) {
      Spannable markdownSpannable=MarkupUtil.returnMarkdown(getContext(),m);
      s.append(markdownSpannable);
    }
 else     if (t != null && !t.trim().equals("String_Node_Str")) {
      s.append(t);
    }
 else {
      continue;
    }
    if (g.repeats() && i > 0) {
      s.append("String_Node_Str").append(String.valueOf(i)).append("String_Node_Str");
    }
    s.append("String_Node_Str");
  }
  if (s.length() > 0) {
    s.delete(s.length() - 2,s.length());
  }
  return s;
}
Program: 142124
Project: 142124
Buggy source:
/** 
 * Returns the hierarchy of groups to which the question belongs.
 */
private SpannableStringBuilder deriveGroupText(FormEntryCaption[] groups){
  SpannableStringBuilder s=new SpannableStringBuilder("String_Node_Str");
  String t;
  String m;
  int i;
  for (  FormEntryCaption g : groups) {
    i=g.getMultiplicity() + 1;
    t=g.getLongText();
    m=g.getMarkdownText();
    if (m != null) {
      Spannable markdownSpannable=MarkupUtil.returnMarkdown(getContext(),m);
      s.append(markdownSpannable);
    }
 else     if (t != null && !t.trim().equals("String_Node_Str")) {
      s.append(t);
    }
 else {
      continue;
    }
    if (g.repeats() && i > 0) {
      s.append("String_Node_Str").append(String.valueOf(i)).append("String_Node_Str");
    }
    s.append("String_Node_Str");
  }
  if (s.length() > 0) {
    s.delete(s.length() - 2,s.length());
  }
  return s;
}

Fixed version (ground truth):
/** 
 * Returns the hierarchy of groups to which the question belongs.
 */
private SpannableStringBuilder deriveGroupText(FormEntryCaption[] groups){
  SpannableStringBuilder s=new SpannableStringBuilder("String_Node_Str");
  String t;
  String m;
  int i;
  for (  FormEntryCaption g : groups) {
    i=g.getMultiplicity() + 1;
    t=g.getLongText();
    m=g.getMarkdownText();
    if (m != null) {
      Spannable markdownSpannable=MarkupUtil.returnMarkdown(getContext(),m);
      s.append(markdownSpannable);
    }
 else     if (t != null) {
      s.append(t);
    }
    if (g.repeats() && i > 0) {
      s.append("String_Node_Str").append(String.valueOf(i)).append("String_Node_Str");
    }
    s.append("String_Node_Str");
  }
  if (s.length() > 0) {
    s.delete(s.length() - 2,s.length());
  }
  return s;
}
Program: 142126
Project: 142126
Buggy source:
/** 
 * Returns the hierarchy of groups to which the question belongs.
 */
private SpannableStringBuilder deriveGroupText(FormEntryCaption[] groups){
  SpannableStringBuilder s=new SpannableStringBuilder("String_Node_Str");
  String t;
  String m;
  int i;
  for (  FormEntryCaption g : groups) {
    i=g.getMultiplicity() + 1;
    t=g.getLongText();
    m=g.getMarkdownText();
    if (m != null) {
      Spannable markdownSpannable=MarkupUtil.returnMarkdown(getContext(),m);
      s.append(markdownSpannable);
    }
 else     if (t != null) {
      s.append(t);
    }
    if (g.repeats() && i > 0) {
      s.append("String_Node_Str").append(String.valueOf(i)).append("String_Node_Str");
    }
    s.append("String_Node_Str");
  }
  if (s.length() > 0) {
    s.delete(s.length() - 2,s.length());
  }
  return s;
}

Fixed version (ground truth):
/** 
 * Returns the hierarchy of groups to which the question belongs.
 */
private SpannableStringBuilder deriveGroupText(FormEntryCaption[] groups){
  SpannableStringBuilder s=new SpannableStringBuilder("String_Node_Str");
  String t;
  String m;
  int i;
  for (  FormEntryCaption g : groups) {
    i=g.getMultiplicity() + 1;
    t=g.getLongText();
    m=g.getMarkdownText();
    if (m != null) {
      Spannable markdownSpannable=MarkupUtil.returnMarkdown(getContext(),m);
      s.append(markdownSpannable);
    }
 else     if (t != null && !t.trim().equals("String_Node_Str")) {
      s.append(t);
    }
 else {
      continue;
    }
    if (g.repeats() && i > 0) {
      s.append("String_Node_Str").append(String.valueOf(i)).append("String_Node_Str");
    }
    s.append("String_Node_Str");
  }
  if (s.length() > 0) {
    s.delete(s.length() - 2,s.length());
  }
  return s;
}
Program: 142127
Project: 142127
Buggy source:
public static UniversalDate fromMillis(long millisFromJavaEpoch){
  long millisFromMinDay=millisFromJavaEpoch - MIN_MILLIS_FROM_JAVA_EPOCH;
  long daysFromMinDay=millisFromMinDay / UniversalDate.MILLIS_IN_DAY;
  int days=-1;
  for (int year=MIN_YEAR; year <= MAX_YEAR; year++) {
    int[] monthsInYear=NEPALI_YEAR_MONTHS.get(year);
    for (int month=1; month <= 12; month++) {
      int daysInMonth=monthsInYear[month];
      for (int day=1; day <= daysInMonth; day++) {
        days++;
        if (days == daysFromMinDay) {
          return new UniversalDate(year,month,day,millisFromJavaEpoch);
        }
      }
    }
  }
  throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
public static UniversalDate fromMillis(long millisFromJavaEpoch){
  return fromMillis(millisFromJavaEpoch,TimeZone.getDefault());
}
Program: 142128
Project: 142128
Buggy source:
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  String appId=appIdDropdownList.get(position);
  boolean appChanged=!appId.equals(CommCareApplication._().getCurrentApp().getUniqueId());
  if (appChanged) {
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
    prefs.edit().putString(KEY_LAST_APP,appId).commit();
    Intent i=new Intent(this,SeatAppActivity.class);
    i.putExtra(KEY_APP_TO_SEAT,appId);
    this.startActivityForResult(i,SEAT_APP_ACTIVITY);
  }
}

Fixed version (ground truth):
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  String appId=appIdDropdownList.get(position);
  boolean selectedNewApp=!appId.equals(CommCareApplication._().getCurrentApp().getUniqueId());
  if (selectedNewApp) {
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
    prefs.edit().putString(KEY_LAST_APP,appId).commit();
    Intent i=new Intent(this,SeatAppActivity.class);
    i.putExtra(KEY_APP_TO_SEAT,appId);
    this.startActivityForResult(i,SEAT_APP_ACTIVITY);
  }
}
Program: 142129
Project: 142129
Buggy source:
@Override public void refreshView(){
  updateBanner();
  activity.restoreEnteredTextFromRotation();
  ArrayList<ApplicationRecord> readyApps=CommCareApplication._().getUsableAppRecords();
  if (readyApps.size() == 1) {
    ApplicationRecord r=readyApps.get(0);
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(activity);
    prefs.edit().putString(LoginActivity.KEY_LAST_APP,r.getUniqueId()).commit();
    setSingleAppUIState();
  }
 else {
    activity.populateAppSpinner(readyApps);
  }
  if (DevSessionRestorer.savedSessionPresent()) {
    restoreSessionCheckbox.setVisibility(View.VISIBLE);
  }
 else {
    restoreSessionCheckbox.setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
@Override public void refreshView(){
  updateBanner();
  activity.restoreEnteredTextFromRotation();
  ArrayList<ApplicationRecord> readyApps=CommCareApplication._().getUsableAppRecords();
  if (readyApps.size() == 1) {
    ApplicationRecord r=readyApps.get(0);
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(activity);
    prefs.edit().putString(LoginActivity.KEY_LAST_APP,r.getUniqueId()).commit();
    setSingleAppUIState();
  }
 else {
    activity.populateAppSpinner(readyApps);
  }
  if (DevSessionRestorer.savedSessionPresent()) {
    restoreSessionCheckbox.setVisibility(View.VISIBLE);
  }
 else {
    restoreSessionCheckbox.setVisibility(View.GONE);
  }
  if (activity.checkForSeatedAppChange()) {
    refreshForNewApp();
  }
}
Program: 142130
Project: 142130
Buggy source:
@Override protected void onCreateSessionSafe(Bundle savedInstanceState) throws SessionUnavailableException {
  super.onCreateSessionSafe(savedInstanceState);
  if (savedInstanceState != null) {
    loginExtraWasConsumed=savedInstanceState.getBoolean(EXTRA_CONSUMED_KEY);
  }
  ACRAUtil.registerAppData();
  uiController.setupUI();
  sessionNavigator=new SessionNavigator(this);
  formAndDataSyncer=new FormAndDataSyncer(this);
  processFromExternalLaunch(savedInstanceState);
  processFromShortcutLaunch();
  processFromLoginLaunch();
}

Fixed version (ground truth):
@Override protected void onCreateSessionSafe(Bundle savedInstanceState) throws SessionUnavailableException {
  super.onCreateSessionSafe(savedInstanceState);
  loadInstanceState(savedInstanceState);
  ACRAUtil.registerAppData();
  uiController.setupUI();
  sessionNavigator=new SessionNavigator(this);
  formAndDataSyncer=new FormAndDataSyncer(this);
  processFromExternalLaunch(savedInstanceState);
  processFromShortcutLaunch();
  processFromLoginLaunch();
}
Program: 142131
Project: 142131
Buggy source:
private void clearSessionAndExit(AndroidSessionWrapper currentState,boolean shouldWarnUser){
  currentState.reset();
  if (wasExternal) {
    this.finish();
  }
  uiController.refreshView();
  if (shouldWarnUser) {
    showSessionRefreshWarning();
  }
}

Fixed version (ground truth):
private void clearSessionAndExit(AndroidSessionWrapper currentState,boolean shouldWarnUser){
  currentState.reset();
  if (wasExternal) {
    setResult(RESULT_CANCELED);
    this.finish();
  }
  uiController.refreshView();
  if (shouldWarnUser) {
    showSessionRefreshWarning();
  }
}
Program: 142133
Project: 142133
Buggy source:
/** 
 * Set state that signifies activity was launch from external app.
 */
private void processFromExternalLaunch(Bundle savedInstanceState){
  if (savedInstanceState != null) {
    wasExternal=savedInstanceState.getBoolean(WAS_EXTERNAL_KEY);
  }
 else {
    if (getIntent().hasExtra(DispatchActivity.WAS_EXTERNAL)) {
      wasExternal=true;
      sessionNavigator.startNextSessionStep();
    }
  }
}

Fixed version (ground truth):
/** 
 * Set state that signifies activity was launch from external app.
 */
private void processFromExternalLaunch(Bundle savedInstanceState){
  if (savedInstanceState == null && getIntent().hasExtra(DispatchActivity.WAS_EXTERNAL)) {
    wasExternal=true;
    sessionNavigator.startNextSessionStep();
  }
}
Program: 142134
Project: 142134
Buggy source:
private void handleExternalLaunch(){
  String sessionRequest=this.getIntent().getStringExtra(SESSION_REQUEST);
  SessionStateDescriptor ssd=new SessionStateDescriptor();
  ssd.fromBundle(sessionRequest);
  CommCareApplication._().getCurrentSessionWrapper().loadFromStateDescription(ssd);
  Intent i=new Intent(this,CommCareHomeActivity.class);
  i.putExtra(WAS_EXTERNAL,true);
  startActivity(i);
}

Fixed version (ground truth):
private void handleExternalLaunch(){
  String sessionRequest=this.getIntent().getStringExtra(SESSION_REQUEST);
  SessionStateDescriptor ssd=new SessionStateDescriptor();
  ssd.fromBundle(sessionRequest);
  CommCareApplication._().getCurrentSessionWrapper().loadFromStateDescription(ssd);
  Intent i=new Intent(this,CommCareHomeActivity.class);
  i.putExtra(WAS_EXTERNAL,true);
  startActivityForResult(i,HOME_SCREEN);
}
Program: 142135
Project: 142135
Buggy source:
/** 
 * Display exception details as a pop-up to the user.
 * @param e Exception to handle
 */
protected void displayException(Exception e){
  String title=Localization.get("String_Node_Str");
  String message=Localization.get("String_Node_Str",new String[]{e.getMessage()});
  DialogInterface.OnClickListener listener=new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int i){
switch (i) {
case DialogInterface.BUTTON_POSITIVE:
        finish();
      break;
  }
}
}
;
AlertDialogFactory f=AlertDialogFactory.getBasicAlertFactoryWithIcon(this,title,message,android.R.drawable.ic_dialog_info,listener);
showAlertDialog(f);
}

Fixed version (ground truth):
/** 
 * Display exception details as a pop-up to the user.
 * @param e Exception to handle
 */
public void displayException(Exception e){
  String title=Localization.get("String_Node_Str");
  String message=Localization.get("String_Node_Str",new String[]{e.getMessage()});
  DialogInterface.OnClickListener listener=new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int i){
switch (i) {
case DialogInterface.BUTTON_POSITIVE:
        finish();
      break;
  }
}
}
;
AlertDialogFactory f=AlertDialogFactory.getBasicAlertFactoryWithIcon(this,title,message,android.R.drawable.ic_dialog_info,listener);
showAlertDialog(f);
}
Program: 142136
Project: 142136
Buggy source:
@Override protected int getWakeLockLevel(){
  return PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE;
}

Fixed version (ground truth):
@Override public int getWakeLockLevel(){
  return PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE;
}
Program: 142137
Project: 142137
Buggy source:
@Override protected int getWakeLockLevel(){
  return PowerManager.PARTIAL_WAKE_LOCK;
}

Fixed version (ground truth):
@Override public int getWakeLockLevel(){
  return PowerManager.PARTIAL_WAKE_LOCK;
}
Program: 142138
Project: 142138
Buggy source:
/** 
 * Launch the DispatchActivity, clearing the activity backstack down to its first occurrence, which should be at the very bottom of the stack. The backstack clearing is necessary for exiting out of the app if the login activity is cancelled
 */
protected static void redirectToLogin(Context context){
  Intent i=new Intent(context.getApplicationContext(),DispatchActivity.class);
  i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  context.startActivity(i);
}

Fixed version (ground truth):
/** 
 * Launch the DispatchActivity, clearing the activity backstack down to its first occurrence, which should be at the very bottom of the stack. The backstack clearing is necessary for exiting out of the app if the login activity is cancelled
 */
public static void redirectToLogin(Context context){
  Intent i=new Intent(context.getApplicationContext(),DispatchActivity.class);
  i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  context.startActivity(i);
}
Program: 142139
Project: 142139
Buggy source:
private void handleXpathErrorBroadcast(){
  CommCareActivity.createErrorDialog(FormEntryActivity.this,"String_Node_Str" + badLocationXpath,EXIT);
}

Fixed version (ground truth):
private void handleXpathErrorBroadcast(){
  UserfacingErrorHandling.createErrorDialog(FormEntryActivity.this,"String_Node_Str" + badLocationXpath,EXIT);
}
Program: 142140
Project: 142140
Buggy source:
public EntityListAdapter(Activity activity,Detail detail,List<TreeReference> references,List<Entity<TreeReference>> full,int[] sort,NodeEntityFactory factory){
  this.detail=detail;
  if (detail.getCustomActions() != null) {
    actionsCount=0;
  }
 else {
    actionsCount=detail.getCustomActions().size();
  }
  this.full=full;
  setCurrent(new ArrayList<Entity<TreeReference>>());
  this.references=references;
  this.context=activity;
  this.observers=new ArrayList<>();
  mNodeFactory=factory;
  mAsyncMode=(factory instanceof AsyncNodeEntityFactory);
  if (!mAsyncMode) {
    if (sort.length != 0) {
      sort(sort);
    }
    filterValues("String_Node_Str");
  }
 else {
    setCurrent(new ArrayList<>(full));
  }
  if (android.os.Build.VERSION.SDK_INT >= 14) {
    mImageLoader=new CachingAsyncImageLoader(context);
  }
 else {
    mImageLoader=null;
  }
  usesGridView=detail.usesGridView();
  this.mFuzzySearchEnabled=CommCarePreferences.isFuzzySearchEnabled();
}

Fixed version (ground truth):
public EntityListAdapter(Activity activity,Detail detail,List<TreeReference> references,List<Entity<TreeReference>> full,int[] sort,NodeEntityFactory factory){
  this.detail=detail;
  if (detail.getCustomActions() != null) {
    actionsCount=detail.getCustomActions().size();
  }
 else {
    actionsCount=0;
  }
  this.full=full;
  setCurrent(new ArrayList<Entity<TreeReference>>());
  this.references=references;
  this.context=activity;
  this.observers=new ArrayList<>();
  mNodeFactory=factory;
  mAsyncMode=(factory instanceof AsyncNodeEntityFactory);
  if (!mAsyncMode) {
    if (sort.length != 0) {
      sort(sort);
    }
    filterValues("String_Node_Str");
  }
 else {
    setCurrent(new ArrayList<>(full));
  }
  if (android.os.Build.VERSION.SDK_INT >= 14) {
    mImageLoader=new CachingAsyncImageLoader(context);
  }
 else {
    mImageLoader=null;
  }
  usesGridView=detail.usesGridView();
  this.mFuzzySearchEnabled=CommCarePreferences.isFuzzySearchEnabled();
}
Program: 142141
Project: 142141
Buggy source:
@Override public void onItemClick(AdapterView<?> listView,View view,int position,long id){
  if (id == EntityListAdapter.SPECIAL_ACTION) {
    triggerDetailAction(position - adapter.getCount());
    return;
  }
  TreeReference selection=adapter.getItem(position);
  if (CommCarePreferences.isEntityDetailLoggingEnabled()) {
    Logger.log(EntityDetailActivity.class.getSimpleName(),selectDatum.getLongDetail());
  }
  if (inAwesomeMode) {
    displayReferenceAwesome(selection,position);
    updateSelectedItem(selection,false);
  }
 else {
    Intent i=EntityDetailUtils.getDetailIntent(getApplicationContext(),selection,null,selectDatum,asw);
    i.putExtra("String_Node_Str",position);
    if (mNoDetailMode) {
      returnWithResult(i);
    }
 else {
      startActivityForResult(i,CONFIRM_SELECT);
    }
  }
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> listView,View view,int position,long id){
  if (id == EntityListAdapter.SPECIAL_ACTION) {
    triggerDetailAction(position - (adapter.getCount() - 1));
    return;
  }
  TreeReference selection=adapter.getItem(position);
  if (CommCarePreferences.isEntityDetailLoggingEnabled()) {
    Logger.log(EntityDetailActivity.class.getSimpleName(),selectDatum.getLongDetail());
  }
  if (inAwesomeMode) {
    displayReferenceAwesome(selection,position);
    updateSelectedItem(selection,false);
  }
 else {
    Intent i=EntityDetailUtils.getDetailIntent(getApplicationContext(),selection,null,selectDatum,asw);
    i.putExtra("String_Node_Str",position);
    if (mNoDetailMode) {
      returnWithResult(i);
    }
 else {
      startActivityForResult(i,CONFIRM_SELECT);
    }
  }
}
Program: 142142
Project: 142142
Buggy source:
private static void startSessionService(UserKeyRecord keyRecord,String password){
  CommCareSessionService ccService=new CommCareSessionService();
  ccService.createCipherPool();
  ccService.prepareStorage(keyRecord.unWrapKey(password),keyRecord);
  ccService.startSession(getUserFromDb(ccService,keyRecord));
  CommCareApplication._().setTestingService(ccService);
}

Fixed version (ground truth):
private static void startSessionService(UserKeyRecord keyRecord,String password){
  CommCareSessionService ccService=new CommCareSessionService();
  ccService.createCipherPool();
  ccService.prepareStorage(keyRecord.unWrapKey(password),keyRecord);
  ccService.startSession(getUserFromDb(ccService,keyRecord),keyRecord);
  CommCareApplication._().setTestingService(ccService);
}
Program: 142148
Project: 142148
Buggy source:
@Override public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){
  new AppDatabaseUpgrader().upgrade(db,oldVersion,newVersion);
}

Fixed version (ground truth):
@Override public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){
  new AppDatabaseUpgrader(context).upgrade(db,oldVersion,newVersion);
}
Program: 142149
Project: 142149
Buggy source:
public SqlStorage(String table,Class<? extends T> ctype,AndroidDbHelper helper){
  this.table=table;
  this.ctype=ctype;
  this.helper=helper;
  try {
    T e=ctype.newInstance();
    if (e instanceof EncryptedModel) {
      em=(EncryptedModel)e;
    }
  }
 catch (  IllegalAccessException|InstantiationException ie) {
    ie.printStackTrace();
  }
}

Fixed version (ground truth):
public SqlStorage(String table,Class<? extends T> ctype,AndroidDbHelper helper){
  this.table=table;
  this.ctype=ctype;
  this.helper=helper;
  try {
    T e=ctype.newInstance();
    if (e instanceof EncryptedModel) {
      em=(EncryptedModel)e;
    }
  }
 catch (  IllegalAccessException ie) {
    ie.printStackTrace();
  }
catch (  InstantiationException ie) {
    ie.printStackTrace();
  }
}
Program: 142150
Project: 142150
Buggy source:
/** 
 * This is the entry point for processing a form. New transaction types should all be declared here. 
 */
public FormRecord process(FormRecord record) throws InvalidStructureException, IOException, XmlPullParserException, UnfullfilledRequirementsException {
  String form=record.getPath(c);
  final File f=new File(form);
  final Cipher decrypter=FormUploadUtil.getDecryptCipher((new SecretKeySpec(record.getAesKey(),"String_Node_Str")));
  InputStream is=new CipherInputStream(new FileInputStream(f),decrypter);
  XmlFormRecordProcessor.process(new AndroidSandbox(CommCareApplication._()),is);
  Intent i=new Intent("String_Node_Str");
  this.c.sendBroadcast(i);
  return updateRecordStatus(record,FormRecord.STATUS_UNSENT);
}

Fixed version (ground truth):
/** 
 * This is the entry point for processing a form. New transaction types should all be declared here. 
 */
public FormRecord process(FormRecord record) throws InvalidStructureException, IOException, XmlPullParserException, UnfullfilledRequirementsException {
  String form=record.getPath(c);
  final File f=new File(form);
  final Cipher decrypter=FormUploadUtil.getDecryptCipher((new SecretKeySpec(record.getAesKey(),"String_Node_Str")));
  InputStream is=new CipherInputStream(new FileInputStream(f),decrypter);
  AndroidTransactionParserFactory factory=new AndroidTransactionParserFactory(c,null);
  factory.initCaseParser();
  factory.initStockParser();
  XmlFormRecordProcessor.process(new AndroidSandbox(CommCareApplication._()),is,factory);
  Intent i=new Intent("String_Node_Str");
  this.c.sendBroadcast(i);
  return updateRecordStatus(record,FormRecord.STATUS_UNSENT);
}
Program: 142151
Project: 142151
Buggy source:
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Bundle extras=getIntent().getExtras();
  String title=extras.getString(GraphView.TITLE);
  if (title == null) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
  }
 else   if (title.length() > 0) {
    setTitle(title);
  }
  String html=extras.getString(GraphView.HTML);
  GraphView view=new GraphView(this,title,true);
  try {
    WebView view=(WebView)mView.getView(html);
    setContentView(view);
  }
 catch (  InvalidStateException e) {
    e.printStackTrace();
    finish();
  }
}

Fixed version (ground truth):
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Bundle extras=getIntent().getExtras();
  String title=extras.getString(GraphView.TITLE);
  if (title == null) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
  }
 else   if (title.length() > 0) {
    setTitle(title);
  }
  String html=extras.getString(GraphView.HTML);
  GraphView graphView=new GraphView(this,title,true);
  try {
    WebView webView=(WebView)graphView.getView(html);
    setContentView(webView);
  }
 catch (  InvalidStateException e) {
    e.printStackTrace();
    finish();
  }
}
Program: 142152
Project: 142152
Buggy source:
private static Vector<String> getHiddenButtons(){
  Vector<String> hiddenButtons=new Vector<>();
  Profile p=CommCareApplication._().getCommCarePlatform().getCurrentProfile();
  if ((p != null && !p.isFeatureActive(Profile.FEATURE_REVIEW)) || !CommCarePreferences.isSavedFormsEnabled()) {
    hiddenButtons.add("String_Node_Str");
  }
  if (!CommCarePreferences.isIncompleteFormsEnabled()) {
    hiddenButtons.add("String_Node_Str");
  }
  if (!DeveloperPreferences.isHomeReportEnabled()) {
    hiddenButtons.add("String_Node_Str");
  }
  return hiddenButtons;
}

Fixed version (ground truth):
private static Vector<String> getHiddenButtons(){
  CommCareApp ccApp=CommCareApplication._().getCurrentApp();
  Vector<String> hiddenButtons=new Vector<>();
  if (ccApp == null) {
    hiddenButtons.addAll(Arrays.asList(HomeButtons.buttonNames));
    return hiddenButtons;
  }
  Profile p=ccApp.getCommCarePlatform().getCurrentProfile();
  if ((p != null && !p.isFeatureActive(Profile.FEATURE_REVIEW)) || !CommCarePreferences.isSavedFormsEnabled()) {
    hiddenButtons.add("String_Node_Str");
  }
  if (!CommCarePreferences.isIncompleteFormsEnabled()) {
    hiddenButtons.add("String_Node_Str");
  }
  if (!DeveloperPreferences.isHomeReportEnabled()) {
    hiddenButtons.add("String_Node_Str");
  }
  return hiddenButtons;
}
Program: 142153
Project: 142153
Buggy source:
/** 
 * Parse given double time value into string acceptable to C3.
 * @param days The time, measured in days since the epoch.
 */
protected String convertTime(double days){
  mCalendar.setTimeInMillis((long)(days * 24 * 60* 60* 1000));
  String time=mCalendar.get(Calendar.YEAR) + "String_Node_Str" + mCalendar.get(Calendar.MONTH)+ "String_Node_Str"+ mCalendar.get(Calendar.DAY_OF_MONTH)+ "String_Node_Str"+ mCalendar.get(Calendar.HOUR_OF_DAY)+ "String_Node_Str"+ mCalendar.get(Calendar.MINUTE)+ "String_Node_Str"+ mCalendar.get(Calendar.SECOND);
  return time;
}

Fixed version (ground truth):
/** 
 * Parse given double time value into string acceptable to C3.
 * @param days The time, measured in days since the epoch.
 */
protected String convertTime(double days){
  Date d=new Date((long)(days * 24 * 60* 60* 1000));
  return mDateFormat.format(d);
}
Program: 142154
Project: 142154
Buggy source:
@Override public void afterTextChanged(Editable s){
  if (getSearchText() == s) {
    filterString=s.toString();
    if (adapter != null) {
      adapter.applyFilter(filterString);
    }
  }
  if (!isUsingActionBar()) {
    lastQueryString=filterString;
  }
}

Fixed version (ground truth):
@Override public void afterTextChanged(Editable incomingEditable){
  final String incomingString=incomingEditable.toString();
  final String currentSearchText=getSearchText().toString();
  if (incomingString.equals(currentSearchText)) {
    filterString=currentSearchText;
    if (adapter != null) {
      adapter.applyFilter(filterString);
    }
  }
  if (!isUsingActionBar()) {
    lastQueryString=filterString;
  }
}
Program: 142155
Project: 142155
Buggy source:
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public void onActionBarFound(MenuItem searchItem,SearchView searchView){
  EntitySelectActivity.this.searchItem=searchItem;
  EntitySelectActivity.this.searchView=searchView;
  if (lastQueryString != null && lastQueryString.length() > 0) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
      searchItem.expandActionView();
    }
    searchView.setQuery(lastQueryString,false);
    if (BuildConfig.DEBUG) {
      Log.v(TAG,"String_Node_Str" + lastQueryString + "String_Node_Str");
    }
    if (adapter != null) {
      adapter.applyFilter(lastQueryString == null ? "String_Node_Str" : lastQueryString);
    }
  }
  EntitySelectActivity.this.searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener(){
    @Override public boolean onQueryTextSubmit(    String query){
      return true;
    }
    @Override public boolean onQueryTextChange(    String newText){
      lastQueryString=newText;
      if (adapter != null) {
        adapter.applyFilter(newText);
      }
      return false;
    }
  }
);
}

Fixed version (ground truth):
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public void onActionBarFound(MenuItem searchItem,SearchView searchView){
  EntitySelectActivity.this.searchItem=searchItem;
  EntitySelectActivity.this.searchView=searchView;
  if (lastQueryString != null && lastQueryString.length() > 0) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
      searchItem.expandActionView();
    }
    searchView.setQuery(lastQueryString,false);
    if (BuildConfig.DEBUG) {
      Log.v(TAG,"String_Node_Str" + lastQueryString + "String_Node_Str");
    }
    if (adapter != null) {
      adapter.applyFilter(lastQueryString == null ? "String_Node_Str" : lastQueryString);
    }
  }
  EntitySelectActivity.this.searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener(){
    @Override public boolean onQueryTextSubmit(    String query){
      return true;
    }
    @Override public boolean onQueryTextChange(    String newText){
      lastQueryString=newText;
      filterString=newText;
      if (adapter != null) {
        adapter.applyFilter(newText);
      }
      return false;
    }
  }
);
}