nus-yam/ex-repair huggingface dataset:
Program: 153141
Project: 153141
Buggy source:
/** 
 * Method to sort the list of Notes by their dates (increasing index for later dates)
 */
public void sortNotesByDate(){
  LinkedList<Notes> resultNote=new LinkedList<Notes>();
  resultNote.add(notes.get(i));
  for (int i=1; i < notes.size(); i++) {
    Notes currNote=notes.get(i);
    for (int j=0; j < resultNote.size(); j++) {
      Notes nowNote=resultNote.get(j);
      if (currNote.getYear() < nowNote.getYear()) {
        resultNote.add(j,currNote);
      }
 else       if (currNote.getYear() == currNote.getYear()) {
        if (currNote.getMonth() < nowNote.getMonth()) {
          resultNote.add(j,currNote);
        }
 else         if (currNote.getMonth() == currNote.getMonth()) {
          if (currNote.getDay() < nowNote.getDay()) {
            resultNote.add(j,currNote);
          }
 else           if (currNote.getDay() > currNote.getDay()) {
            if (j == resultNote.size() - 1) {
              resultNote.add(currNote);
            }
          }
        }
 else         if (currNote.getMonth() > currNote.getMonth() && j == resultNote.size() - 1) {
          resultNote.add(currNote);
        }
      }
 else       if (currNote.getYear() > currNote.getYear() && j == resultNote.size() - 1) {
        resultNote.add(currNote);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Method to sort the list of Notes by their dates (increasing index for later dates)
 */
public void sortNotesByDate(){
  LinkedList<Notes> resultNote=new LinkedList<Notes>();
  resultNote.add(notes.get(i));
  for (int i=1; i < notes.size(); i++) {
    Notes currNote=notes.get(i);
    for (int j=0; j < resultNote.size(); j++) {
      Notes nowNote=resultNote.get(j);
      if (currNote.getYear() < nowNote.getYear()) {
        resultNote.add(j,currNote);
      }
 else       if (currNote.getYear() == nowNote.getYear()) {
        if (currNote.getMonth() < nowNote.getMonth()) {
          resultNote.add(j,currNote);
        }
 else         if (currNote.getMonth() == nowNote.getMonth()) {
          if (currNote.getDay() < nowNote.getDay()) {
            resultNote.add(j,currNote);
          }
 else           if (currNote.getDay() > nowNote.getDay()) {
            if (j == resultNote.size() - 1) {
              resultNote.add(currNote);
            }
          }
        }
 else         if (currNote.getMonth() > nowNote.getMonth() && j == resultNote.size() - 1) {
          resultNote.add(currNote);
        }
      }
 else       if (currNote.getYear() > nowNote.getYear() && j == resultNote.size() - 1) {
        resultNote.add(currNote);
      }
    }
  }
}
Program: 153142
Project: 153142
Buggy source:
/** 
 * Method to sort the list of Biometricss by their dates (increasing index for later dates)
 */
public void sortBiomByDate(){
  LinkedList<Biometric> resultBiom=new LinkedList<Biometric>();
  resultBiom.add(biometrics.get(i));
  for (int i=1; i < biometrics.size(); i++) {
    Biometric currBiom=biometrics.get(i);
    for (int j=0; j < resultBiom.size(); j++) {
      Biometric nowBiom=resultBiom.get(j);
      if (currBiom.getYear() < nowBiom.getYear()) {
        resultBiom.add(j,currBiom);
      }
 else       if (currBiom.getYear() == currBiom.getYear()) {
        if (currBiom.getMonth() < nowBiom.getMonth()) {
          resultBiom.add(j,currBiom);
        }
 else         if (currBiom.getMonth() == currBiom.getMonth()) {
          if (currBiom.getDay() < nowBiom.getDay()) {
            resultBiom.add(j,currBiom);
          }
 else           if (currBiom.getDay() > currBiom.getDay()) {
            if (j == resultBiom.size() - 1) {
              resultBiom.add(currBiom);
            }
          }
        }
 else         if (currBiom.getMonth() > currBiom.getMonth() && j == resultBiom.size() - 1) {
          resultBiom.add(currBiom);
        }
      }
 else       if (currBiom.getYear() > currBiom.getYear() && j == resultBiom.size() - 1) {
        resultBiom.add(currBiom);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Method to sort the list of Biometricss by their dates (increasing index for later dates)
 */
public void sortBiomByDate(){
  LinkedList<Biometric> resultBiom=new LinkedList<Biometric>();
  resultBiom.add(biometrics.get(i));
  for (int i=1; i < biometrics.size(); i++) {
    Biometric currBiom=biometrics.get(i);
    for (int j=0; j < resultBiom.size(); j++) {
      Biometric nowBiom=resultBiom.get(j);
      if (currBiom.getYear() < nowBiom.getYear()) {
        resultBiom.add(j,currBiom);
      }
 else       if (currBiom.getYear() == nowBiom.getYear()) {
        if (currBiom.getMonth() < nowBiom.getMonth()) {
          resultBiom.add(j,currBiom);
        }
 else         if (currBiom.getMonth() == nowBiom.getMonth()) {
          if (currBiom.getDay() < nowBiom.getDay()) {
            resultBiom.add(j,currBiom);
          }
 else           if (currBiom.getDay() > nowBiom.getDay()) {
            if (j == resultBiom.size() - 1) {
              resultBiom.add(currBiom);
            }
          }
        }
 else         if (currBiom.getMonth() > nowBiom.getMonth() && j == resultBiom.size() - 1) {
          resultBiom.add(currBiom);
        }
      }
 else       if (currBiom.getYear() > nowBiom.getYear() && j == resultBiom.size() - 1) {
        resultBiom.add(currBiom);
      }
    }
  }
}
Program: 153143
Project: 153143
Buggy source:
/** 
 * Method to sort the list of WODs by their dates (increasing index for later dates)
 */
public void sortWodByDate(){
  LinkedList<WOD> resultWod=new LinkedList<WOD>();
  resultWod.add(wods.get(i));
  for (int i=1; i < wods.size(); i++) {
    WOD currWod=wods.get(i);
    for (int j=0; j < resultWod.size(); j++) {
      WOD nowWod=resultWod.get(j);
      if (currWod.getYear() < nowWod.getYear()) {
        resultWod.add(j,currWod);
      }
 else       if (currWod.getYear() == currWod.getYear()) {
        if (currWod.getMonth() < nowWod.getMonth()) {
          resultWod.add(j,currWod);
        }
 else         if (currWod.getMonth() == currWod.getMonth()) {
          if (currWod.getDay() < nowWod.getDay()) {
            resultWod.add(j,currWod);
          }
 else           if (currWod.getDay() > currWod.getDay()) {
            if (j == resultWod.size() - 1) {
              resultWod.add(currWod);
            }
          }
        }
 else         if (currWod.getMonth() > currWod.getMonth() && j == resultWod.size() - 1) {
          resultWod.add(currWod);
        }
      }
 else       if (currWod.getYear() > currWod.getYear() && j == resultWod.size() - 1) {
        resultWod.add(currWod);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Method to sort the list of WODs by their dates (increasing index for later dates)
 */
public void sortWodByDate(){
  LinkedList<WOD> resultWod=new LinkedList<WOD>();
  resultWod.add(wods.get(i));
  for (int i=1; i < wods.size(); i++) {
    WOD currWod=wods.get(i);
    for (int j=0; j < resultWod.size(); j++) {
      WOD nowWod=resultWod.get(j);
      if (currWod.getYear() < nowWod.getYear()) {
        resultWod.add(j,currWod);
      }
 else       if (currWod.getYear() == nowWod.getYear()) {
        if (currWod.getMonth() < nowWod.getMonth()) {
          resultWod.add(j,currWod);
        }
 else         if (currWod.getMonth() == nowWod.getMonth()) {
          if (currWod.getDay() < nowWod.getDay()) {
            resultWod.add(j,currWod);
          }
 else           if (currWod.getDay() > nowWod.getDay()) {
            if (j == resultWod.size() - 1) {
              resultWod.add(currWod);
            }
          }
        }
 else         if (currWod.getMonth() > nowWod.getMonth() && j == resultWod.size() - 1) {
          resultWod.add(currWod);
        }
      }
 else       if (currWod.getYear() > nowWod.getYear() && j == resultWod.size() - 1) {
        resultWod.add(currWod);
      }
    }
  }
}
Program: 153144
Project: 153144
Buggy source:
public LinkedList<WOD> searchWODTags(String[] tags){
  LinkedList<WOD> results=new LinkedList<WOD>();
  int findTags, infoIndex, infoTags, found=0;
  for (infoIndex=0; infoIndex < wods.size(); infoIndex++) {
    for (findTags=0; findTags < tags.length; findTags++) {
      for (infoTags=0; infoTags < wods.get(infoIndex).getTags().size(); infoTags++) {
        if (wods.get(infoIndex).getTags().get(infoTags) == tags[findTags]) {
          found++;
          break;
        }
      }
    }
    if (found == tags.length) {
      results.add(wods.get(infoIndex));
    }
  }
  return results;
}

Fixed version (ground truth):
/** 
 * Method to search through WOD, Notes, and Biometrics by tags and return all relevant info
 * @param (String logType) - type of log info to search through
 * @param (String[] tags) - list of tags to search for
 * @return - list of WODs, Notes, and Biometrics with said tags
 */
public LinkedList<WOD> searchWODTags(String[] tags){
  LinkedList<WOD> results=new LinkedList<WOD>();
  int findTags, infoIndex, infoTags, found=0;
  for (infoIndex=0; infoIndex < wods.size(); infoIndex++) {
    for (findTags=0; findTags < tags.length; findTags++) {
      for (infoTags=0; infoTags < wods.get(infoIndex).getTags().size(); infoTags++) {
        if (wods.get(infoIndex).getTags().get(infoTags) == tags[findTags]) {
          found++;
          break;
        }
      }
    }
    if (found == tags.length) {
      results.add(wods.get(infoIndex));
    }
  }
  return results;
}
Program: 153145
Project: 153145
Buggy source:
/** 
 * Method to convert date from MMDDYY to MM/DD/YY
 * @return - date (MM/DD/YY)
 */
public String toDate(){
  String newDate="String_Node_Str";
  newDate+=date.substring(0,2) + "String_Node_Str";
  newDate+=date.substring(2,4) + "String_Node_Str";
  newDate+=date.substring(4,8);
  return newDate;
}

Fixed version (ground truth):
/** 
 * Method to convert date from MMDDYYYY to MM/DD/YYYY
 * @return - date (MM/DD/YYYY)
 */
public String toDate(){
  String newDate="String_Node_Str";
  newDate+=date.substring(0,2) + "String_Node_Str";
  newDate+=date.substring(2,4) + "String_Node_Str";
  newDate+=date.substring(4,8);
  return newDate;
}
Program: 153146
Project: 153146
Buggy source:
/** 
 * Method to convert date from MMDDYY to MM/DD/YY
 * @return - date (MM/DD/YY)
 */
public String toDate(){
  String newDate="String_Node_Str";
  newDate+=date.substring(0,2) + "String_Node_Str";
  newDate+=date.substring(2,4) + "String_Node_Str";
  newDate+=date.substring(4,8);
  return newDate;
}

Fixed version (ground truth):
/** 
 * Method to convert date from MMDDYYYY to MM/DD/YYYY
 * @return - date (MM/DD/YYYY)
 */
public String toDate(){
  String newDate="String_Node_Str";
  newDate+=date.substring(0,2) + "String_Node_Str";
  newDate+=date.substring(2,4) + "String_Node_Str";
  newDate+=date.substring(4,8);
  return newDate;
}
Program: 153147
Project: 153147
Buggy source:
public void sortNotesByDate(){
  LinkedList<Notes> resultNote=new LinkedList<Notes>();
  resultNote.add(notes.get(i));
  for (int i=1; i < notes.size(); i++) {
    Notes currNote=notes.get(i);
    for (int j=0; j < resultNote.size(); j++) {
      Notes nowNote=resultNote.get(j);
      if (currNote.getYear() < nowNote.getYear()) {
        resultNote.add(j,currNote);
      }
 else       if (currNote.getYear() == currNote.getYear()) {
        if (currNote.getMonth() < nowNote.getMonth()) {
          resultNote.add(j,currNote);
        }
 else         if (currNote.getMonth() == currNote.getMonth()) {
          if (currNote.getDay() < nowNote.getDay()) {
            resultNote.add(j,currNote);
          }
 else           if (currNote.getDay() > currNote.getDay()) {
            if (j == resultNote.size() - 1) {
              resultNote.add(currNote);
            }
          }
        }
 else         if (currNote.getMonth() > currNote.getMonth() && j == resultNote.size() - 1) {
          resultNote.add(currNote);
        }
      }
 else       if (currNote.getYear() > currNote.getYear() && j == resultNote.size() - 1) {
        resultNote.add(currNote);
      }
    }
  }
}

Fixed version (ground truth):
public void sortNotesByDate(){
  LinkedList<Notes> resultNote=new LinkedList<Notes>();
  resultNote.add(notes.get(i));
  for (int i=1; i < notes.size(); i++) {
    Notes currNote=notes.get(i);
    for (int j=0; j < resultNote.size(); j++) {
      Notes nowNote=resultNote.get(j);
      if (currNote.getYear() < nowNote.getYear()) {
        resultNote.add(j,currNote);
      }
 else       if (currNote.getYear() == nowNote.getYear()) {
        if (currNote.getMonth() < nowNote.getMonth()) {
          resultNote.add(j,currNote);
        }
 else         if (currNote.getMonth() == nowNote.getMonth()) {
          if (currNote.getDay() < nowNote.getDay()) {
            resultNote.add(j,currNote);
          }
 else           if (currNote.getDay() > nowNote.getDay()) {
            if (j == resultNote.size() - 1) {
              resultNote.add(currNote);
            }
          }
        }
 else         if (currNote.getMonth() > nowNote.getMonth() && j == resultNote.size() - 1) {
          resultNote.add(currNote);
        }
      }
 else       if (currNote.getYear() > nowNote.getYear() && j == resultNote.size() - 1) {
        resultNote.add(currNote);
      }
    }
  }
  notes=resultNote;
}
Program: 153148
Project: 153148
Buggy source:
public void sortBiomByDate(){
  LinkedList<Biometric> resultBiom=new LinkedList<Biometric>();
  resultBiom.add(biometrics.get(i));
  for (int i=1; i < biometrics.size(); i++) {
    Biometric currBiom=biometrics.get(i);
    for (int j=0; j < resultBiom.size(); j++) {
      Biometric nowBiom=resultBiom.get(j);
      if (currBiom.getYear() < nowBiom.getYear()) {
        resultBiom.add(j,currBiom);
      }
 else       if (currBiom.getYear() == currBiom.getYear()) {
        if (currBiom.getMonth() < nowBiom.getMonth()) {
          resultBiom.add(j,currBiom);
        }
 else         if (currBiom.getMonth() == currBiom.getMonth()) {
          if (currBiom.getDay() < nowBiom.getDay()) {
            resultBiom.add(j,currBiom);
          }
 else           if (currBiom.getDay() > currBiom.getDay()) {
            if (j == resultBiom.size() - 1) {
              resultBiom.add(currBiom);
            }
          }
        }
 else         if (currBiom.getMonth() > currBiom.getMonth() && j == resultBiom.size() - 1) {
          resultBiom.add(currBiom);
        }
      }
 else       if (currBiom.getYear() > currBiom.getYear() && j == resultBiom.size() - 1) {
        resultBiom.add(currBiom);
      }
    }
  }
}

Fixed version (ground truth):
public void sortBiomByDate(){
  LinkedList<Biometric> resultBiom=new LinkedList<Biometric>();
  resultBiom.add(biometrics.get(i));
  for (int i=1; i < biometrics.size(); i++) {
    Biometric currBiom=biometrics.get(i);
    for (int j=0; j < resultBiom.size(); j++) {
      Biometric nowBiom=resultBiom.get(j);
      if (currBiom.getYear() < nowBiom.getYear()) {
        resultBiom.add(j,currBiom);
      }
 else       if (currBiom.getYear() == nowBiom.getYear()) {
        if (currBiom.getMonth() < nowBiom.getMonth()) {
          resultBiom.add(j,currBiom);
        }
 else         if (currBiom.getMonth() == nowBiom.getMonth()) {
          if (currBiom.getDay() < nowBiom.getDay()) {
            resultBiom.add(j,currBiom);
          }
 else           if (currBiom.getDay() > nowBiom.getDay()) {
            if (j == resultBiom.size() - 1) {
              resultBiom.add(currBiom);
            }
          }
        }
 else         if (currBiom.getMonth() > nowBiom.getMonth() && j == resultBiom.size() - 1) {
          resultBiom.add(currBiom);
        }
      }
 else       if (currBiom.getYear() > nowBiom.getYear() && j == resultBiom.size() - 1) {
        resultBiom.add(currBiom);
      }
    }
  }
  biometrics=resultBiom;
}
Program: 153149
Project: 153149
Buggy source:
public void sortWodByDate(){
  LinkedList<WOD> resultWod=new LinkedList<WOD>();
  resultWod.add(wods.get(i));
  for (int i=1; i < wods.size(); i++) {
    WOD currWod=wods.get(i);
    for (int j=0; j < resultWod.size(); j++) {
      WOD nowWod=resultWod.get(j);
      if (currWod.getYear() < nowWod.getYear()) {
        resultWod.add(j,currWod);
      }
 else       if (currWod.getYear() == currWod.getYear()) {
        if (currWod.getMonth() < nowWod.getMonth()) {
          resultWod.add(j,currWod);
        }
 else         if (currWod.getMonth() == currWod.getMonth()) {
          if (currWod.getDay() < nowWod.getDay()) {
            resultWod.add(j,currWod);
          }
 else           if (currWod.getDay() > currWod.getDay()) {
            if (j == resultWod.size() - 1) {
              resultWod.add(currWod);
            }
          }
        }
 else         if (currWod.getMonth() > currWod.getMonth() && j == resultWod.size() - 1) {
          resultWod.add(currWod);
        }
      }
 else       if (currWod.getYear() > currWod.getYear() && j == resultWod.size() - 1) {
        resultWod.add(currWod);
      }
    }
  }
}

Fixed version (ground truth):
public void sortWodByDate(){
  LinkedList<WOD> resultWod=new LinkedList<WOD>();
  resultWod.add(wods.get(i));
  for (int i=1; i < wods.size(); i++) {
    WOD currWod=wods.get(i);
    for (int j=0; j < resultWod.size(); j++) {
      WOD nowWod=resultWod.get(j);
      if (currWod.getYear() < nowWod.getYear()) {
        resultWod.add(j,currWod);
      }
 else       if (currWod.getYear() == nowWod.getYear()) {
        if (currWod.getMonth() < nowWod.getMonth()) {
          resultWod.add(j,currWod);
        }
 else         if (currWod.getMonth() == nowWod.getMonth()) {
          if (currWod.getDay() < nowWod.getDay()) {
            resultWod.add(j,currWod);
          }
 else           if (currWod.getDay() > nowWod.getDay()) {
            if (j == resultWod.size() - 1) {
              resultWod.add(currWod);
            }
          }
        }
 else         if (currWod.getMonth() > nowWod.getMonth() && j == resultWod.size() - 1) {
          resultWod.add(currWod);
        }
      }
 else       if (currWod.getYear() > nowWod.getYear() && j == resultWod.size() - 1) {
        resultWod.add(currWod);
      }
    }
  }
  wods=resultWod;
}
Program: 153151
Project: 153151
Buggy source:
@Override public Object createWidget(MUIElement element,Object parent){
  JToolBar bar=new JToolBar();
  bar.setRollover(true);
  bar.setFloatable(false);
  bar.setMargin(new Insets(10,10,10,10));
  return bar;
}

Fixed version (ground truth):
@Override public Object createWidget(MUIElement element,Object parent){
  System.err.println("String_Node_Str" + element);
  JToolBar bar=new JToolBar();
  bar.setRollover(true);
  bar.setFloatable(false);
  bar.setMargin(new Insets(10,10,10,10));
  return bar;
}
Program: 153152
Project: 153152
Buggy source:
@Override public Object createWidget(MUIElement element,Object parent){
  JPanel bar=new JPanel();
  bar.setLayout(new SwingFillLayout());
  ((JPanel)parent).add(bar,BorderLayout.PAGE_START);
  return bar;
}

Fixed version (ground truth):
@Override public Object createWidget(MUIElement element,Object parent){
  JPanel bar=new JPanel();
  bar.setLayout(new BoxLayout(bar,BoxLayout.X_AXIS));
  ((JPanel)parent).add(bar,BorderLayout.PAGE_START);
  return bar;
}
Program: 153153
Project: 153153
Buggy source:
public void enableGuard(){
  IntentFilter filter=new IntentFilter(Constants.ACTION_PKG_STATE_CHANGED);
  mContext.registerReceiver(mDownloadReceiver,filter);
}

Fixed version (ground truth):
public void enableGuard(){
  IntentFilter filter=new IntentFilter(Constants.ACTION_PKG_STATE_CHANGED);
  mContext.registerReceiver(mDownloadReceiver,filter);
  updateAppState();
}
Program: 153155
Project: 153155
Buggy source:
private void checkUpdate(Map<String,String> codesVersionMap){
  if (0 == codesVersionMap.size()) {
    return;
  }
  AppListParser appListParser=new AppListParser();
  String reqStr=UrlHelpers.getUpdateRequestString(codesVersionMap);
  Log.d(TAG,"String_Node_Str" + reqStr);
  try {
    String token=TokenWrapper.getToken(mContext);
    String url=UrlHelpers.getUpdateUrl(token);
    Log.d(TAG,"String_Node_Str" + url);
    ArrayList<AppInfo> appList=appListParser.getUpdateList(url,reqStr,codesVersionMap.size());
    Log.i(TAG,"String_Node_Str" + Integer.toString(appList.size()));
    ContentValues cv=new ContentValues();
    for (int i=0; i < appList.size(); ++i) {
      AppInfo appInfo=appList.get(i);
      cv.put(InstalledAppDb.COLUMN_STATE,PackageState.need_update.name());
      cv.put(InstalledAppDb.COLUMN_AUTHOR,appInfo.mAppAuthor);
      cv.put(InstalledAppDb.COLUMN_DESC,appInfo.mAppShortDesc);
      cv.put(InstalledAppDb.COLUMN_VERSION,appInfo.mAppVersion);
      cv.put(InstalledAppDb.COLUMN_IMAGE_URL,appInfo.mAppImageUrl);
      cv.put(InstalledAppDb.COLUMN_APP_NAME,appInfo.mAppName);
      String where=InstalledAppDb.COLUMN_CODE + "String_Node_Str";
      String[] selectionArgs={appInfo.mAppCode};
      mContext.getContentResolver().update(BehooProvider.INSTALLED_APP_CONTENT_URI,cv,where,selectionArgs);
    }
    Intent intent=new Intent(Constants.ACTION_PKG_UPDATE_FINISHED);
    intent.putExtra(Constants.EXTRA_SIZE,appList.size());
    mContext.sendBroadcast(intent);
  }
 catch (  Throwable tr) {
    tr.printStackTrace();
  }
 finally {
    appListParser.cancel();
  }
}

Fixed version (ground truth):
private void checkUpdate(Map<String,String> codesVersionMap){
  if (0 == codesVersionMap.size()) {
    notifyCheckUpdateCompleted(null);
    return;
  }
  AppListParser appListParser=new AppListParser();
  String reqStr=UrlHelpers.getUpdateRequestString(codesVersionMap);
  try {
    String token=TokenWrapper.getToken(mContext);
    String url=UrlHelpers.getUpdateUrl(token);
    Log.d(TAG,"String_Node_Str" + url);
    ArrayList<AppInfo> appList=appListParser.getUpdateList(url,reqStr,codesVersionMap.size());
    Log.i(TAG,"String_Node_Str" + Integer.toString(appList.size()));
    ContentValues cv=new ContentValues();
    for (int i=0; i < appList.size(); ++i) {
      AppInfo appInfo=appList.get(i);
      cv.put(InstalledAppDb.COLUMN_STATE,PackageState.need_update.name());
      cv.put(InstalledAppDb.COLUMN_AUTHOR,appInfo.mAppAuthor);
      cv.put(InstalledAppDb.COLUMN_DESC,appInfo.mAppShortDesc);
      cv.put(InstalledAppDb.COLUMN_VERSION,appInfo.mAppVersion);
      cv.put(InstalledAppDb.COLUMN_IMAGE_URL,appInfo.mAppImageUrl);
      cv.put(InstalledAppDb.COLUMN_APP_NAME,appInfo.mAppName);
      String where=InstalledAppDb.COLUMN_CODE + "String_Node_Str";
      String[] selectionArgs={appInfo.mAppCode};
      mContext.getContentResolver().update(BehooProvider.INSTALLED_APP_CONTENT_URI,cv,where,selectionArgs);
    }
    notifyCheckUpdateCompleted(appList);
  }
 catch (  Throwable tr) {
    notifyCheckUpdateCompleted(null);
  }
 finally {
    appListParser.cancel();
  }
}
Program: 153156
Project: 153156
Buggy source:
public Object getItem(int position){
  if (mCursor.moveToPosition(position)) {
    return mAppLib.get(position).mAppCode;
  }
  return null;
}

Fixed version (ground truth):
public Object getItem(int position){
  if (mCursor.moveToPosition(position)) {
    return mCursor.getString(mCodeId);
  }
  return null;
}
Program: 153157
Project: 153157
Buggy source:
public void onItemSelected(AdapterView<?> arg0,View arg1,int position,long id){
  String code=(String)mListView.getItemAtPosition(position);
  if (null != code) {
    AppInfo appInfo=mAppLib.get(code);
    mButtonGuard.setAppInfo(appInfo);
    updateUIState(appInfo);
  }
 else {
    mButtonGuard.setAppInfo(null);
  }
}

Fixed version (ground truth):
public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  String code=(String)mListView.getItemAtPosition(position);
  if (null != code) {
    AppInfo appInfo=mAppLib.get(code);
    mButtonGuard.setAppInfo(appInfo);
    updateUIState(appInfo);
  }
 else {
    mButtonGuard.setAppInfo(null);
  }
}
Program: 153158
Project: 153158
Buggy source:
private void updateButtonAndUIs(String code){
  if (null != code) {
    AppInfo appInfo=mAppLib.get(code);
    mButtonGuard.setAppInfo(appInfo);
    updateUIState(appInfo);
  }
 else {
    mButtonGuard.setAppInfo(null);
  }
}

Fixed version (ground truth):
private void updateButtonAndUIs(String code){
  if (null != code) {
    AppInfo appInfo=mAppLib.get(code);
    if (null != appInfo) {
      mButtonGuard.setAppInfo(appInfo);
      updateUIState(appInfo);
    }
 else {
      mButtonGuard.setAppInfo(null);
    }
  }
 else {
    mButtonGuard.setAppInfo(null);
  }
}
Program: 153159
Project: 153159
Buggy source:
private void updateImage(AppInfo appInfo){
  if (null == ImageLib.inst().getBitmap(appInfo.mAppImageUrl)) {
    if (false == ImageLib.inst().isImageDownloading(appInfo.mAppImageUrl)) {
      executeImageTask(appInfo.mAppImageUrl,appInfo.mAppCode);
    }
 else {
      mAppImage.setImageResource(R.drawable.appicon_default);
    }
  }
 else {
    mAppImage.setImageBitmap(ImageLib.inst().getBitmap(appInfo.mAppImageUrl));
  }
}

Fixed version (ground truth):
private void updateImage(AppInfo appInfo){
  if (null != appInfo) {
    mAppImage.setVisibility(View.VISIBLE);
    if (null == ImageLib.inst().getBitmap(appInfo.mAppImageUrl)) {
      if (false == ImageLib.inst().isImageDownloading(appInfo.mAppImageUrl)) {
        executeImageTask(appInfo.mAppImageUrl,appInfo.mAppCode);
      }
 else {
        mAppImage.setImageResource(R.drawable.appicon_default);
      }
    }
 else {
      mAppImage.setImageBitmap(ImageLib.inst().getBitmap(appInfo.mAppImageUrl));
    }
  }
 else {
    mAppImage.setVisibility(View.INVISIBLE);
  }
}
Program: 153160
Project: 153160
Buggy source:
public void onResume(){
  super.onResume();
  mInstallButtonGuard.enableGuard();
  IntentFilter filter=new IntentFilter(Constants.ACTION_PKG_STATE_CHANGED);
  registerReceiver(mReceiver,filter);
}

Fixed version (ground truth):
public void onResume(){
  super.onResume();
  mInstallButtonGuard.enableGuard();
  IntentFilter filter=new IntentFilter(Constants.ACTION_PKG_STATE_CHANGED);
  registerReceiver(mReceiver,filter);
  String code=(String)mListView.getSelectedItem();
  updateButtonAndUIs(code);
}
Program: 153161
Project: 153161
Buggy source:
public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  String code=(String)mListView.getItemAtPosition(position);
  if (null != code) {
    AppInfo appInfo=mCodeAppInfoMap.get(code);
    if (null != appInfo) {
      mInstallButtonGuard.setAppInfo(appInfo);
      updateUIState(appInfo);
    }
  }
}

Fixed version (ground truth):
public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  String code=(String)mListView.getItemAtPosition(position);
  updateButtonAndUIs(code);
}
Program: 153162
Project: 153162
Buggy source:
private void updateUIState(AppInfo appInfo){
  TextView tv=(TextView)findViewById(R.id.main_app_title);
  tv.setText(appInfo.mAppName);
  tv=(TextView)findViewById(R.id.main_app_author);
  tv.setText(appInfo.mAppAuthor);
  tv=(TextView)findViewById(R.id.main_app_version);
  tv.setText(appInfo.mAppVersion);
  if (mCodeSizeMap.containsKey(appInfo.mAppCode)) {
    mTextViewSize.setVisibility(View.VISIBLE);
    mTextViewSize.setText(mCodeSizeMap.get(appInfo.mAppCode));
  }
 else {
    mTextViewSize.setVisibility(View.GONE);
  }
  tv=(TextView)findViewById(R.id.downloadpage_desc);
  tv.setText(appInfo.mAppShortDesc);
  updateImage(appInfo);
}

Fixed version (ground truth):
private void updateUIState(AppInfo appInfo){
  TextView tvTitle=(TextView)findViewById(R.id.main_app_title);
  TextView tvAuthor=(TextView)findViewById(R.id.main_app_author);
  TextView tvVersion=(TextView)findViewById(R.id.main_app_version);
  TextView tvDesc=(TextView)findViewById(R.id.downloadpage_desc);
  if (null != appInfo) {
    tvTitle.setText(appInfo.mAppName);
    tvAuthor.setText(appInfo.mAppAuthor);
    tvVersion.setText(appInfo.mAppVersion);
    if (mCodeSizeMap.containsKey(appInfo.mAppCode)) {
      mTextViewSize.setVisibility(View.VISIBLE);
      mTextViewSize.setText(mCodeSizeMap.get(appInfo.mAppCode));
    }
 else {
      mTextViewSize.setVisibility(View.GONE);
    }
    tvDesc.setText(appInfo.mAppShortDesc);
  }
 else {
    tvTitle.setText("String_Node_Str");
    tvAuthor.setText("String_Node_Str");
    tvVersion.setText("String_Node_Str");
    mTextViewSize.setVisibility(View.GONE);
    tvDesc.setText("String_Node_Str");
  }
  updateImage(appInfo);
}
Program: 153163
Project: 153163
Buggy source:
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.app_update_page);
  String[] columns={InstalledAppDb.COLUMN_ID,InstalledAppDb.COLUMN_CODE,InstalledAppDb.COLUMN_APP_NAME,InstalledAppDb.COLUMN_AUTHOR,InstalledAppDb.COLUMN_VERSION,InstalledAppDb.COLUMN_IMAGE_URL,InstalledAppDb.COLUMN_DESC};
  String where=InstalledAppDb.COLUMN_STATE + "String_Node_Str";
  String[] whereArgs={InstalledAppDb.PackageState.install_succeeded.name()};
  mCursor=managedQuery(BehooProvider.INSTALLED_APP_CONTENT_URI,columns,where,whereArgs,null);
  mListView=(ListView)findViewById(R.id.app_update_list);
  mListAdapter=new ListAdapter(this,R.layout.applist_item_layout,mCursor);
  mListView.setAdapter(mListAdapter);
  mListView.setOnItemSelectedListener(this);
  Button button=(Button)findViewById(R.id.appupdate_btn_update);
  mButtonGuard=new InstallButtonGuard(this,button,null);
  mButtonGuard.setOnInstallClickListener(this);
  mAppImage=(ImageView)findViewById(R.id.main_app_logo);
  Intent i=new Intent(this,DownloadInstallService.class);
  i.setAction(Constants.ACTION_START_CHECK_UPDATE);
  startService(i);
  showDialog(WAITING_DIALOG);
}

Fixed version (ground truth):
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.app_update_page);
  String[] columns={InstalledAppDb.COLUMN_ID,InstalledAppDb.COLUMN_CODE,InstalledAppDb.COLUMN_APP_NAME,InstalledAppDb.COLUMN_AUTHOR,InstalledAppDb.COLUMN_VERSION,InstalledAppDb.COLUMN_IMAGE_URL,InstalledAppDb.COLUMN_DESC};
  String where=InstalledAppDb.COLUMN_STATE + "String_Node_Str";
  String[] whereArgs={PackageState.need_update.name()};
  mCursor=managedQuery(BehooProvider.INSTALLED_APP_CONTENT_URI,columns,where,whereArgs,null);
  mListView=(ListView)findViewById(R.id.app_update_list);
  mListAdapter=new ListAdapter(this,R.layout.applist_item_layout,mCursor);
  mListView.setAdapter(mListAdapter);
  mListView.setOnItemSelectedListener(this);
  Button button=(Button)findViewById(R.id.appupdate_btn_update);
  mButtonGuard=new InstallButtonGuard(this,button,null);
  mButtonGuard.setOnInstallClickListener(this);
  mAppImage=(ImageView)findViewById(R.id.main_app_logo);
  Intent i=new Intent(this,DownloadInstallService.class);
  i.setAction(Constants.ACTION_START_CHECK_UPDATE);
  startService(i);
  showDialog(WAITING_DIALOG);
}
Program: 153164
Project: 153164
Buggy source:
public void onResume(){
  super.onResume();
  mButtonGuard.enableGuard();
  registerReceiver(mReceiver,new IntentFilter(Constants.ACTION_PKG_UPDATE_FINISHED));
}

Fixed version (ground truth):
public void onResume(){
  super.onResume();
  mButtonGuard.enableGuard();
  registerReceiver(mReceiver,new IntentFilter(Constants.ACTION_PKG_UPDATE_FINISHED));
  String code=(String)mListView.getSelectedItem();
  updateButtonAndUIs(code);
}
Program: 153165
Project: 153165
Buggy source:
public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  String code=(String)mListView.getItemAtPosition(position);
  if (null != code) {
    AppInfo appInfo=mAppLib.get(code);
    mButtonGuard.setAppInfo(appInfo);
    updateUIState(appInfo);
  }
 else {
    mButtonGuard.setAppInfo(null);
  }
}

Fixed version (ground truth):
public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  String code=(String)mListView.getItemAtPosition(position);
  updateButtonAndUIs(code);
}
Program: 153167
Project: 153167
Buggy source:
private void installApp(String uri,String code){
  boolean bDownloadRet=false;
  String filename="String_Node_Str";
  if (PkgsProviderWrapper.isAppExists(this,code)) {
    String[] projects={Downloads._DATA,Downloads.COLUMN_STATUS};
    Cursor c=this.getContentResolver().query(Uri.parse(uri),projects,null,null,null);
    if (null != c && c.moveToFirst()) {
      int filenameId=c.getColumnIndexOrThrow(Downloads._DATA);
      int statusId=c.getColumnIndexOrThrow(Downloads.COLUMN_STATUS);
      int status=c.getInt(statusId);
      if (Downloads.isStatusSuccess(status)) {
        bDownloadRet=true;
        filename="String_Node_Str" + c.getString(filenameId);
      }
    }
    if (null != c) {
      c.close();
    }
  }
  ContentValues cv=new ContentValues();
  String statusStr=null;
  if (bDownloadRet) {
    statusStr=PackageState.download_succeeded.name();
  }
 else {
    statusStr=PackageState.download_failed.name();
  }
  cv.put(InstalledAppDb.COLUMN_STATE,statusStr);
  String where=InstalledAppDb.COLUMN_CODE + "String_Node_Str";
  String[] selectionArgs={code};
  getContentResolver().update(BehooProvider.INSTALLED_APP_CONTENT_URI,cv,where,selectionArgs);
  PackageStateSender.sendPackageStateBroadcast(this,code,statusStr);
  if (bDownloadRet) {
    InstallThread thrd=new InstallThread(this,code,filename);
    thrd.start();
  }
}

Fixed version (ground truth):
private void installApp(String uri,String code){
  boolean bDownloadRet=false;
  String filename="String_Node_Str";
  if (PkgsProviderWrapper.isAppExists(this,code)) {
    String[] projects={Downloads._DATA,Downloads.COLUMN_STATUS};
    Cursor c=this.getContentResolver().query(Uri.parse(uri),projects,null,null,null);
    if (null != c && c.moveToFirst()) {
      int filenameId=c.getColumnIndexOrThrow(Downloads._DATA);
      int statusId=c.getColumnIndexOrThrow(Downloads.COLUMN_STATUS);
      int status=c.getInt(statusId);
      if (Downloads.isStatusSuccess(status)) {
        bDownloadRet=true;
        filename="String_Node_Str" + c.getString(filenameId);
      }
    }
    if (null != c) {
      c.close();
    }
  }
  ContentValues cv=new ContentValues();
  String statusStr=null;
  if (bDownloadRet) {
    statusStr=PackageState.download_succeeded.name();
  }
 else {
    statusStr=PackageState.download_failed.name();
  }
  cv.put(InstalledAppDb.COLUMN_STATE,statusStr);
  String where=InstalledAppDb.COLUMN_CODE + "String_Node_Str";
  String[] selectionArgs={code};
  getContentResolver().update(BehooProvider.INSTALLED_APP_CONTENT_URI,cv,where,selectionArgs);
  PackageStateSender.sendPackageStateBroadcast(this,code,statusStr);
  if (bDownloadRet) {
    AppInfo appInfo=PkgsProviderWrapper.getAppInfo(this,code);
    InstallThread thrd=new InstallThread(this,appInfo,filename);
    thrd.start();
  }
}
Program: 153169
Project: 153169
Buggy source:
public InstallThread(Context context,String code,String uri){
  mContext=context;
  mPkgCode=code;
  mPkgSrcUri=uri;
}

Fixed version (ground truth):
public InstallThread(Context context,AppInfo appInfo,String uri){
  mContext=context;
  mAppInfo=appInfo;
  mPkgSrcUri=uri;
}
Program: 153170
Project: 153170
Buggy source:
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.app_update_page);
  String[] columns={InstalledAppDb.COLUMN_ID,InstalledAppDb.COLUMN_CODE,InstalledAppDb.COLUMN_APP_NAME,InstalledAppDb.COLUMN_AUTHOR,InstalledAppDb.COLUMN_VERSION,InstalledAppDb.COLUMN_IMAGE_URL,InstalledAppDb.COLUMN_DOWNLOAD_URI,InstalledAppDb.COLUMN_PKG_NAME};
  String where=InstalledAppDb.COLUMN_STATE + "String_Node_Str";
  String[] whereArgs={InstalledAppDb.PackageState.install_succeeded.name()};
  mCursor=managedQuery(BehooProvider.INSTALLED_APP_CONTENT_URI,columns,where,whereArgs,null);
  mListView=(ListView)findViewById(R.id.app_update_list);
  mListAdapter=new ListAdapter(this,R.layout.applist_item_layout,mCursor);
  mListView.setAdapter(mListAdapter);
  mListView.setOnItemSelectedListener(this);
  Button button=(Button)findViewById(R.id.appupdate_btn_update);
  mButtonGuard=new InstallButtonGuard(this,button,null);
  mButtonGuard.setOnInstallClickListener(this);
  mAppImage=(ImageView)findViewById(R.id.main_app_logo);
  Intent i=new Intent(this,DownloadInstallService.class);
  i.setAction(Constants.ACTION_START_CHECK_UPDATE);
  startService(i);
  showDialog(WAITING_DIALOG);
}

Fixed version (ground truth):
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.app_update_page);
  String[] columns={InstalledAppDb.COLUMN_ID,InstalledAppDb.COLUMN_CODE,InstalledAppDb.COLUMN_APP_NAME,InstalledAppDb.COLUMN_AUTHOR,InstalledAppDb.COLUMN_VERSION,InstalledAppDb.COLUMN_IMAGE_URL,InstalledAppDb.COLUMN_DESC};
  String where=InstalledAppDb.COLUMN_STATE + "String_Node_Str";
  String[] whereArgs={InstalledAppDb.PackageState.install_succeeded.name()};
  mCursor=managedQuery(BehooProvider.INSTALLED_APP_CONTENT_URI,columns,where,whereArgs,null);
  mListView=(ListView)findViewById(R.id.app_update_list);
  mListAdapter=new ListAdapter(this,R.layout.applist_item_layout,mCursor);
  mListView.setAdapter(mListAdapter);
  mListView.setOnItemSelectedListener(this);
  Button button=(Button)findViewById(R.id.appupdate_btn_update);
  mButtonGuard=new InstallButtonGuard(this,button,null);
  mButtonGuard.setOnInstallClickListener(this);
  mAppImage=(ImageView)findViewById(R.id.main_app_logo);
  Intent i=new Intent(this,DownloadInstallService.class);
  i.setAction(Constants.ACTION_START_CHECK_UPDATE);
  startService(i);
  showDialog(WAITING_DIALOG);
}
Program: 153172
Project: 153172
Buggy source:
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.app_download_page);
  String order="String_Node_Str" + "String_Node_Str";
  mDownloadCursor=managedQuery(Downloads.CONTENT_URI,new String[]{"String_Node_Str",Downloads.COLUMN_TITLE,Downloads.COLUMN_STATUS,Downloads.COLUMN_TOTAL_BYTES,Downloads.COLUMN_CURRENT_BYTES,Downloads._DATA,Downloads.COLUMN_DESCRIPTION},null,null,order);
  Button button=(Button)findViewById(R.id.downloadpage_btn_to_install);
  mInstallButtonGuard=new InstallButtonGuard(this,button,null);
  mInstallButtonGuard.setOnInstallClickListener(this);
  mAppImage=(ImageView)findViewById(R.id.main_app_logo);
  mDownloadProgressBar=(ProgressBar)findViewById(R.id.downloadpage_progress);
  mDownloadProgressBar.setVisibility(View.GONE);
  mTextViewSize=(TextView)findViewById(R.id.main_app_size);
  mListView=(ListView)findViewById(R.id.downloadpage_list);
  mListApater=new ListAdapter(this,R.layout.applist_item_layout,mDownloadCursor);
  mListView.setAdapter(mListApater);
  mListView.setOnItemSelectedListener(this);
  mListView.requestFocus();
}

Fixed version (ground truth):
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.app_download_page);
  String order="String_Node_Str" + "String_Node_Str";
  mDownloadCursor=managedQuery(Downloads.CONTENT_URI,new String[]{"String_Node_Str",Downloads.COLUMN_TITLE,Downloads.COLUMN_STATUS,Downloads.COLUMN_TOTAL_BYTES,Downloads.COLUMN_CURRENT_BYTES,Downloads._DATA,Downloads.COLUMN_DESCRIPTION},null,null,order);
  Button button=(Button)findViewById(R.id.downloadpage_btn_to_install);
  mInstallButtonGuard=new InstallButtonGuard(this,button,null);
  mAppImage=(ImageView)findViewById(R.id.main_app_logo);
  mDownloadProgressBar=(ProgressBar)findViewById(R.id.downloadpage_progress);
  mDownloadProgressBar.setVisibility(View.GONE);
  mTextViewSize=(TextView)findViewById(R.id.main_app_size);
  mListView=(ListView)findViewById(R.id.downloadpage_list);
  mListApater=new ListAdapter(this,R.layout.applist_item_layout,mDownloadCursor);
  mListView.setAdapter(mListApater);
  mListView.setOnItemSelectedListener(this);
  mListView.setOnItemClickListener(this);
  mListView.requestFocus();
}
Program: 153173
Project: 153173
Buggy source:
protected void onTaskCompleted(boolean result){
  if (result) {
    mListAdapter.notifyDataSetChanged();
    if (mListView.getCount() > 0) {
      mListView.setSelection(0);
    }
    mListView.requestFocus();
    updateUIState();
  }
}

Fixed version (ground truth):
protected void onTaskCompleted(boolean result){
  if (result) {
    mListAdapter.notifyDataSetChanged();
    mListView.requestFocus();
    updateUIState();
  }
}
Program: 153174
Project: 153174
Buggy source:
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.app_update_page);
  String[] columns={InstalledAppDb.COLUMN_ID,InstalledAppDb.COLUMN_CODE,InstalledAppDb.COLUMN_APP_NAME,InstalledAppDb.COLUMN_AUTHOR,InstalledAppDb.COLUMN_VERSION,InstalledAppDb.COLUMN_IMAGE_URL,InstalledAppDb.COLUMN_DESC};
  String where=InstalledAppDb.COLUMN_STATE + "String_Node_Str";
  String[] whereArgs={PackageState.need_update.name()};
  mCursor=managedQuery(BehooProvider.INSTALLED_APP_CONTENT_URI,columns,where,whereArgs,null);
  mListView=(ListView)findViewById(R.id.app_update_list);
  mListAdapter=new ListAdapter(this,R.layout.applist_item_layout,mCursor);
  mListView.setAdapter(mListAdapter);
  mListView.setOnItemSelectedListener(this);
  Button button=(Button)findViewById(R.id.appupdate_btn_update);
  mButtonGuard=new InstallButtonGuard(this,button,null);
  mButtonGuard.setOnInstallClickListener(this);
  mAppImage=(ImageView)findViewById(R.id.main_app_logo);
  Intent i=new Intent(this,DownloadInstallService.class);
  i.setAction(Constants.ACTION_START_CHECK_UPDATE);
  startService(i);
  showDialog(WAITING_DIALOG);
}

Fixed version (ground truth):
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.app_update_page);
  String[] columns={InstalledAppDb.COLUMN_ID,InstalledAppDb.COLUMN_CODE,InstalledAppDb.COLUMN_APP_NAME,InstalledAppDb.COLUMN_AUTHOR,InstalledAppDb.COLUMN_VERSION,InstalledAppDb.COLUMN_IMAGE_URL,InstalledAppDb.COLUMN_DESC};
  String where=InstalledAppDb.COLUMN_STATE + "String_Node_Str";
  String[] whereArgs={PackageState.need_update.name()};
  mCursor=managedQuery(BehooProvider.INSTALLED_APP_CONTENT_URI,columns,where,whereArgs,null);
  mListView=(ListView)findViewById(R.id.app_update_list);
  mListAdapter=new ListAdapter(this,R.layout.applist_item_layout,mCursor);
  mListView.setAdapter(mListAdapter);
  mListView.setOnItemSelectedListener(this);
  mListView.setOnItemClickListener(this);
  Button button=(Button)findViewById(R.id.appupdate_btn_update);
  mButtonGuard=new InstallButtonGuard(this,button,null);
  mButtonGuard.setOnInstallClickListener(this);
  mAppImage=(ImageView)findViewById(R.id.main_app_logo);
  Intent i=new Intent(this,DownloadInstallService.class);
  i.setAction(Constants.ACTION_START_CHECK_UPDATE);
  startService(i);
  showDialog(WAITING_DIALOG);
}
Program: 153175
Project: 153175
Buggy source:
public void onClick(View v){
switch (mAppState) {
case unknown:
case need_update:
case install_failed:
case download_failed:
    try {
      String url=UrlHelpers.getDownloadUrl(TokenWrapper.getToken(mContext),mAppInfo.mAppCode);
      Intent i=new Intent();
      i.setClass(mContext,DownloadInstallService.class);
      i.setAction(DownloadInstallService.ACTION_INSTALL_APP);
      i.putExtra(DownloadInstallService.EXTRA_HTTP_URL,url);
      i.putExtra(DownloadInstallService.EXTRA_MIME,AppInfo.MIMETYPE);
      i.putExtra(DownloadInstallService.EXTRA_APP_CODE,mAppInfo.mAppCode);
      i.putExtra(DownloadInstallService.EXTRA_APP_VERSION,mAppInfo.mAppVersion);
      i.putExtra(DownloadInstallService.EXTRA_APP_NAME,mAppInfo.mAppName);
      i.putExtra(DownloadInstallService.EXTRA_APP_IMAGE_URL,mAppInfo.mAppImageUrl);
      i.putExtra(DownloadInstallService.EXTRA_APP_AUTHOR,mAppInfo.mAppAuthor);
      i.putExtra(DownloadInstallService.EXTRA_APP_SHORTDESC,mAppInfo.mAppShortDesc);
      mContext.startService(i);
      mListener.onInstallClicked(mAppInfo);
    }
 catch (    Throwable tr) {
      tr.printStackTrace();
    }
  break;
case install_succeeded:
try {
  String pkgName=PkgsProviderWrapper.getAppPkgName(mContext,mAppInfo.mAppCode);
  PackageManager pm=mContext.getPackageManager();
  Intent intent=pm.getLaunchIntentForPackage(pkgName);
  mContext.startActivity(intent);
}
 catch (Throwable tr) {
  tr.printStackTrace();
}
break;
case downloading:
case download_succeeded:
case installing:
default :
Log.e(TAG,"String_Node_Str");
break;
}
}

Fixed version (ground truth):
public void onClick(View v){
switch (mAppState) {
case unknown:
case need_update:
case install_failed:
case download_failed:
    installApp();
  break;
case install_succeeded:
openApp();
break;
case downloading:
case download_succeeded:
case installing:
default :
Log.e(TAG,"String_Node_Str");
break;
}
}
Program: 153176
Project: 153176
Buggy source:
public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  String code=(String)mListView.getItemAtPosition(position);
  if (null != code) {
    mInstallButtonGuard.setAppInfo(mCodeAppInfoMap.get(code));
    updateUIState(mCodeAppInfoMap.get(code));
  }
}

Fixed version (ground truth):
public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  String code=(String)mListView.getItemAtPosition(position);
  if (null != code) {
    AppInfo appInfo=mCodeAppInfoMap.get(code);
    if (null != appInfo) {
      mInstallButtonGuard.setAppInfo(appInfo);
      updateUIState(appInfo);
    }
  }
}
Program: 153177
Project: 153177
Buggy source:
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.app_list_page);
  mListAdapter=new AppListAdapter(this);
  mListView=(ListView)findViewById(R.id.app_list);
  mListView.setAdapter(mListAdapter);
  mListView.setOnItemSelectedListener(this);
  mListView.setOnKeyListener(this);
  Button button=(Button)findViewById(R.id.applist_btn_detail);
  button.setOnClickListener(this);
  mAppImage=(ImageView)findViewById(R.id.main_app_logo);
  mHttpTask=new HttpTask(mHandler);
}

Fixed version (ground truth):
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.app_list_page);
  mListAdapter=new AppListAdapter(this);
  mListView=(ListView)findViewById(R.id.app_list);
  mListView.setAdapter(mListAdapter);
  mListView.setOnItemSelectedListener(this);
  mListView.setOnKeyListener(this);
  Button button=(Button)findViewById(R.id.applist_btn_detail);
  button.setOnClickListener(this);
  mAppImage=(ImageView)findViewById(R.id.main_app_logo);
  mHttpTask=new HttpTask(mHandler);
  executeTask(mHttpTask);
  showDialog(WAITING_DIALOG);
}