nus-yam/ex-repair huggingface dataset:
Program: 109978
Project: 109978
Buggy source:
private void openPreviewHTML(){
  JComboBox csvLabel=(JComboBox)componentMap.get("String_Node_Str");
  if (csvLabel != null) {
    String csv=(String)csvLabel.getSelectedItem();
    try {
      Survey survey;
      if (cachedSurveys.containsKey(csv)) {
        Experiment.loadParameters();
        SurveyPoster.updateProperties();
        survey=cachedSurveys.get(csv);
      }
 else {
        survey=Experiment.makeSurvey();
        cachedSurveys.put(csv,survey);
      }
      HTMLGenerator.spitHTMLToFile(HTMLGenerator.getHTMLString(survey),survey);
      Desktop.getDesktop().browse(new URI("String_Node_Str" + HTMLGenerator.htmlFileName));
    }
 catch (    IOException io) {
      Experiment.updateStatusLabel(String.format("String_Node_Str",HTMLGenerator.htmlFileName));
      SurveyMan.LOGGER.fatal(io);
    }
catch (    SurveyException se) {
      Experiment.updateStatusLabel(se.getMessage());
      SurveyMan.LOGGER.warn(se);
    }
catch (    URISyntaxException uri) {
      SurveyMan.LOGGER.fatal(uri);
    }
  }
}

Fixed version (ground truth):
private void openPreviewHTML(){
  JComboBox csvLabel=(JComboBox)componentMap.get("String_Node_Str");
  if (csvLabel != null) {
    String csv=(String)csvLabel.getSelectedItem();
    try {
      Survey survey;
      if (cachedSurveys.containsKey(csv)) {
        Experiment.loadParameters();
        SurveyPoster.updateProperties();
        survey=cachedSurveys.get(csv);
      }
 else {
        survey=Experiment.makeSurvey();
        cachedSurveys.put(csv,survey);
      }
      HTMLGenerator.spitHTMLToFile(HTMLGenerator.getHTMLString(survey),survey);
      Desktop.getDesktop().browse(new URI("String_Node_Str" + HTMLGenerator.htmlFileName));
    }
 catch (    IOException io) {
      Experiment.updateStatusLabel(String.format("String_Node_Str",HTMLGenerator.htmlFileName));
      SurveyMan.LOGGER.fatal(io);
    }
catch (    SurveyException se) {
      Experiment.updateStatusLabel(se.getMessage());
      cachedSurveys.remove(csv);
      SurveyMan.LOGGER.warn(se);
    }
catch (    URISyntaxException uri) {
      SurveyMan.LOGGER.fatal(uri);
    }
  }
}
Program: 109979
Project: 109979
Buggy source:
public double surveyEntropy(Survey s,ArrayList<SurveyResponse> responses){
  double entropy=0;
  ArrayList<Map<String,Double>> hists=qHistograms(s,responses);
  for (int x=0; x < s.questions.size(); x++) {
    int qopts=s.questions.get(x).options.size();
    for (    Double count : hists.get(x).values()) {
      entropy+=(count / qopts) * Math.log(count / qopts);
    }
  }
  return -entropy;
}

Fixed version (ground truth):
public double surveyEntropy(Survey s,ArrayList<SurveyResponse> responses){
  double entropy=0;
  ArrayList<Map<String,Double>> hists=qHistograms(s,responses);
  double n=responses.size();
  for (int x=0; x < s.questions.size(); x++) {
    for (    Double count : hists.get(x).values()) {
      entropy+=(count / n) * Math.log(count / n);
    }
  }
  return -entropy;
}
Program: 109984
Project: 109984
Buggy source:
public void waitForResults(String successFilePath,String outputFilePath,Map<Integer,String[]> qs,Map<Integer,Map> opts){
  boolean resultsNotIn=true;
  try {
    while (resultsNotIn) {
      Thread.sleep(15000);
      getResults(successFilePath,outputFilePath);
      if (surveyIsComplete(outputFilePath,qs,opts)) {
        resultsNotIn=false;
        System.out.println("String_Node_Str");
      }
 else {
        System.out.println("String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void waitForResults(String successFilePath,String outputFilePath,Map<Integer,String[]> qs,Map<Integer,Map> opts){
  boolean resultsNotIn=true;
  try {
    while (resultsNotIn) {
      Thread.sleep(2 * 60000);
      getResults(successFilePath,outputFilePath);
      if (surveyIsComplete(outputFilePath,qs,opts)) {
        resultsNotIn=false;
        System.out.println("String_Node_Str");
      }
 else {
        System.out.println("String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}
Program: 109987
Project: 109987
Buggy source:
public void waitForResults(String successFilePath,String outputFilePath,Map<Integer,String[]> qs,Map<Integer,Map> opts){
  boolean resultsNotIn=true;
  try {
    while (resultsNotIn) {
      Thread.sleep(2 * 60000);
      getResults(successFilePath,outputFilePath);
      if (surveyIsComplete(outputFilePath,qs,opts)) {
        resultsNotIn=false;
        System.out.println("String_Node_Str");
      }
 else {
        System.out.println("String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void waitForResults(String successFilePath,String outputFilePath,Map<Integer,String[]> qs,Map<Integer,Map> opts){
  boolean resultsNotIn=true;
  try {
    while (resultsNotIn) {
      Thread.sleep(15000);
      getResults(successFilePath,outputFilePath);
      if (surveyIsComplete(outputFilePath,qs,opts)) {
        resultsNotIn=false;
        System.out.println("String_Node_Str");
      }
 else {
        System.out.println("String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}
Program: 109992
Project: 109992
Buggy source:
public static void main(String[] args){
  String fileContents="String_Node_Str";
  String[] lines;
  if (args.length == 0) {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  parser csvParser=new parser();
  try {
    fileContents=csvParser.readFile(args[0]);
  }
 catch (  java.io.FileNotFoundException e) {
    System.out.println("String_Node_Str");
  }
  lines=csvParser.split(fileContents);
  for (int i=0; i < lines.length; i++) {
    for (    String s : csvParser.parse(lines[i])) {
      System.out.println("String_Node_Str" + s + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  String fileContents="String_Node_Str";
  String[] lines;
  if (args.length == 0) {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  parser csvParser=new parser();
  try {
    fileContents=csvParser.readFile(args[0]);
  }
 catch (  java.io.FileNotFoundException e) {
    System.out.println("String_Node_Str");
  }
  lines=csvParser.split(fileContents);
  for (int i=0; i < lines.length; i++) {
    System.out.println("String_Node_Str" + lines[i]);
    for (    String s : csvParser.parse(lines[i])) {
      System.out.println("String_Node_Str" + s + "String_Node_Str");
    }
  }
}
Program: 109993
Project: 109993
Buggy source:
public String[] parse(String csv){
  matcher=csvPattern.matcher(csv);
  allMatches.clear();
  String match;
  while (matcher.find()) {
    match=matcher.group(1);
    if (matcher.group(1) != null) {
      allMatches.add(match);
    }
 else     if (matcher.group(2) != null) {
      allMatches.add(matcher.group(2));
    }
 else     if (matcher.group(3) != null) {
      allMatches.add(matcher.group(3));
    }
 else {
      allMatches.add(matcher.group(4).replace("String_Node_Str","String_Node_Str"));
    }
  }
  size=allMatches.size();
  if (size > 0) {
    return allMatches.toArray(new String[size]);
  }
 else {
    return new String[0];
  }
}

Fixed version (ground truth):
public String[] parse(String csv){
  matcher=csvPattern.matcher(csv);
  allMatches.clear();
  String match;
  while (matcher.find()) {
    match=matcher.group(1);
    if (matcher.group(1) != null) {
      allMatches.add(match);
    }
 else     if (matcher.group(2) != null) {
      allMatches.add(matcher.group(2));
    }
 else     if (matcher.group(3) != null) {
      allMatches.add(matcher.group(3));
    }
 else {
      allMatches.add(matcher.group(4));
    }
  }
  size=allMatches.size();
  if (size > 0) {
    return allMatches.toArray(new String[size]);
  }
 else {
    return new String[0];
  }
}
Program: 109995
Project: 109995
Buggy source:
static void generateSurvey(ArrayList<String[]> questions){
  try {
    PrintWriter out=new PrintWriter(new FileWriter("String_Node_Str"));
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    int count=0;
    questions=randomize(questions);
    for (    String[] question : questions) {
      count++;
      out.println(generateQuestion(count,question));
    }
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.flush();
  }
 catch (  java.io.IOException e) {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  return;
}

Fixed version (ground truth):
static void generateSurvey(ArrayList<String[]> questions){
  try {
    PrintWriter out=new PrintWriter(new FileWriter("String_Node_Str"));
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    int count=0;
    questions=randomize(questions);
    for (    String[] question : questions) {
      count++;
      out.println(generateQuestion(count,question));
    }
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.flush();
  }
 catch (  java.io.IOException e) {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  return;
}
Program: 109996
Project: 109996
Buggy source:
public int[] getCheckedMusicsSortedByTime(){
  Object[] objs=Utils.getSortedKeyOfTimeMap(mCheckedMap);
  int[] poss=new int[objs.length];
  for (int i=0; i < poss.length; i++)   poss[i]=(int)(long)objs[i];
  return poss;
}

Fixed version (ground truth):
public int[] getCheckedMusicsSortedByTime(){
  Object[] objs=Utils.getSortedKeyOfTimeMap(mCheckedMap);
  int[] poss=new int[objs.length];
  for (int i=0; i < poss.length; i++)   poss[i]=(int)objs[i];
  return poss;
}
Program: 109997
Project: 109997
Buggy source:
private void appendCheckMusicsToPlayQ(){
  YTVideoSearchAdapter adpr=getAdapter();
  int[] checkedItems=adpr.getCheckItemSortedByTime();
  YTPlayer.Video[] vids=new YTPlayer.Video[checkedItems.length];
  int j=0;
  for (  int i : checkedItems) {
    vids[j++]=adpr.getYTPlayerVideo(i);
  }
  appendToPlayQ(vids);
  adpr.cleanChecked();
}

Fixed version (ground truth):
private void appendCheckMusicsToPlayQ(){
  YTVideoSearchAdapter adpr=getAdapter();
  int[] checkedItems=adpr.getCheckItemSortedByTime();
  YTPlayer.Video[] vids=new YTPlayer.Video[checkedItems.length];
  int j=0;
  for (  int i : checkedItems)   vids[j++]=adpr.getYTPlayerVideo(i);
  appendToPlayQ(vids);
  adpr.cleanChecked();
}
Program: 109998
Project: 109998
Buggy source:
public int[] getCheckItemSortedByTime(){
  Object[] objs=Utils.getSortedKeyOfTimeMap(mCheckedMap);
  int[] poss=new int[objs.length];
  for (int i=0; i < poss.length; i++)   poss[i]=(int)(long)objs[i];
  return poss;
}

Fixed version (ground truth):
public int[] getCheckItemSortedByTime(){
  Object[] objs=Utils.getSortedKeyOfTimeMap(mCheckedMap);
  int[] poss=new int[objs.length];
  for (int i=0; i < poss.length; i++)   poss[i]=(int)objs[i];
  return poss;
}
Program: 109999
Project: 109999
Buggy source:
private static YtVideoHtmlResult parseYtVideoHtml(BufferedReader brdr) throws LocalException {
  String htmlText="String_Node_Str";
  YtVideoHtmlResult result=new YtVideoHtmlResult();
  String line="String_Node_Str";
  while (null != line) {
    try {
      line=brdr.readLine();
    }
 catch (    IOException e) {
      throw new LocalException(Err.IO_NET);
    }
    if (null == line)     break;
    htmlText+=line + "String_Node_Str";
    if (line.contains("String_Node_Str")) {
      result.playable=false;
      if (DBG)       P.v("String_Node_Str");
      break;
    }
 else     if (line.contains("String_Node_Str")) {
      Matcher m=sYtUrlGenerate204Pattern.matcher(line);
      if (m.matches()) {
        line=m.group(1);
        line=line.replaceAll("String_Node_Str","String_Node_Str");
        line=line.replaceAll("String_Node_Str","String_Node_Str");
        result.generate_204_url=line;
      }
    }
 else     if (line.contains("String_Node_Str")) {
      Matcher m=sYtUrlStreamMapPattern.matcher(line);
      if (m.matches()) {
        line=m.group(1);
        String[] vidElemUrls=line.split("String_Node_Str");
        ArrayList<YtVideoElem> al=new ArrayList<>(vidElemUrls.length);
        for (        String s : vidElemUrls) {
          YtVideoElem ve=YtVideoElem.parse(s);
          if (null != ve)           al.add(ve);
        }
        result.vids=al.toArray(new YtVideoElem[al.size()]);
      }
    }
  }
  if (DBG)   P.v(htmlText);
  result.tmstamp=System.currentTimeMillis();
  return result;
}

Fixed version (ground truth):
private static YtVideoHtmlResult parseYtVideoHtml(BufferedReader brdr) throws LocalException {
  String htmlText="String_Node_Str";
  YtVideoHtmlResult result=new YtVideoHtmlResult();
  String line="String_Node_Str";
  while (null != line) {
    try {
      line=brdr.readLine();
    }
 catch (    IOException e) {
      throw new LocalException(Err.IO_NET);
    }
    if (null == line)     break;
    htmlText+=line + "String_Node_Str";
    if (line.contains("String_Node_Str")) {
      ;
    }
 else     if (line.contains("String_Node_Str")) {
      Matcher m=sYtUrlGenerate204Pattern.matcher(line);
      if (m.matches()) {
        line=m.group(1);
        line=line.replaceAll("String_Node_Str","String_Node_Str");
        line=line.replaceAll("String_Node_Str","String_Node_Str");
        result.generate_204_url=line;
      }
    }
 else     if (line.contains("String_Node_Str")) {
      Matcher m=sYtUrlStreamMapPattern.matcher(line);
      if (m.matches()) {
        line=m.group(1);
        String[] vidElemUrls=line.split("String_Node_Str");
        ArrayList<YtVideoElem> al=new ArrayList<>(vidElemUrls.length);
        for (        String s : vidElemUrls) {
          YtVideoElem ve=YtVideoElem.parse(s);
          if (null != ve)           al.add(ve);
        }
        result.vids=al.toArray(new YtVideoElem[al.size()]);
      }
    }
  }
  if (DBG)   P.v(htmlText);
  result.tmstamp=System.currentTimeMillis();
  return result;
}
Program: 110000
Project: 110000
Buggy source:
private static YtVideoHtmlResult parseYtVideoHtml(BufferedReader brdr) throws LocalException {
  YtVideoHtmlResult result=new YtVideoHtmlResult();
  String line="String_Node_Str";
  while (null != line) {
    try {
      line=brdr.readLine();
    }
 catch (    IOException e) {
      throw new LocalException(Err.IO_NET);
    }
    if (null == line)     break;
    if (line.contains("String_Node_Str")) {
      result.playable=false;
      break;
    }
 else     if (line.contains("String_Node_Str")) {
      Matcher m=sYtUrlGenerate204Pattern.matcher(line);
      if (m.matches()) {
        line=m.group(1);
        line=line.replaceAll("String_Node_Str","String_Node_Str");
        line=line.replaceAll("String_Node_Str","String_Node_Str");
        result.generate_204_url=line;
      }
    }
 else     if (line.contains("String_Node_Str")) {
      Matcher m=sYtUrlStreamMapPattern.matcher(line);
      if (m.matches()) {
        line=m.group(1);
        String[] vidElemUrls=line.split("String_Node_Str");
        ArrayList<YtVideoElem> al=new ArrayList<>(vidElemUrls.length);
        for (        String s : vidElemUrls) {
          YtVideoElem ve=YtVideoElem.parse(s);
          if (null != ve)           al.add(ve);
        }
        result.vids=al.toArray(new YtVideoElem[al.size()]);
      }
    }
  }
  result.tmstamp=System.currentTimeMillis();
  return result;
}

Fixed version (ground truth):
private static YtVideoHtmlResult parseYtVideoHtml(BufferedReader brdr) throws LocalException {
  YtVideoHtmlResult result=new YtVideoHtmlResult();
  String line="String_Node_Str";
  String content="String_Node_Str";
  while (null != line) {
    try {
      line=brdr.readLine();
    }
 catch (    IOException e) {
      throw new LocalException(Err.IO_NET);
    }
    if (null == line)     break;
    content+=line + "String_Node_Str";
    if (line.contains("String_Node_Str")) {
      ;
    }
 else     if (line.contains("String_Node_Str")) {
      Matcher m=sYtUrlGenerate204Pattern.matcher(line);
      if (m.matches()) {
        line=m.group(1);
        line=line.replaceAll("String_Node_Str","String_Node_Str");
        line=line.replaceAll("String_Node_Str","String_Node_Str");
        result.generate_204_url=line;
      }
    }
 else     if (line.contains("String_Node_Str")) {
      Matcher m=sYtUrlStreamMapPattern.matcher(line);
      if (m.matches()) {
        line=m.group(1);
        String[] vidElemUrls=line.split("String_Node_Str");
        ArrayList<YtVideoElem> al=new ArrayList<>(vidElemUrls.length);
        for (        String s : vidElemUrls) {
          YtVideoElem ve=YtVideoElem.parse(s);
          if (null != ve)           al.add(ve);
        }
        result.vids=al.toArray(new YtVideoElem[al.size()]);
      }
    }
  }
  P.i(content);
  result.tmstamp=System.currentTimeMillis();
  return result;
}
Program: 110001
Project: 110001
Buggy source:
private void pvOnMoreButtonClicked(View v){
  final YTPlayer.Video video=mMp.getActiveVideo();
  if (null == video)   return;
  final int[] opts;
  final Long vid=(Long)mDb.getVideoInfo(video.ytvid,ColVideo.ID);
  if (null != vid)   opts=new int[]{R.string.detail_info,R.string.set_bookmark,R.string.bookmarks,R.string.add_to,R.string.volume,R.string.delete};
 else   opts=new int[]{R.string.add_to,R.string.delete,R.string.volume};
  final CharSequence[] items=new CharSequence[opts.length];
  for (int i=0; i < opts.length; i++)   items[i]=Utils.getResText(opts[i]);
  AlertDialog.Builder builder=new AlertDialog.Builder(mVActivity);
  builder.setTitle(R.string.player_extra_control_title);
  builder.setItems(items,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int item){
switch (opts[item]) {
case R.string.detail_info:
        pvMoreControlDetailInfo(vid);
      break;
case R.string.set_bookmark:
    pvMoreControlSetBookmark(vid);
  break;
case R.string.bookmarks:
UiUtils.showBookmarkDialog(mVActivity,video.ytvid,video.title);
break;
case R.string.add_to:
pvMoreControlAddTo(vid,video);
break;
case R.string.volume:
changeVideoVolume(video.title,video.ytvid);
break;
case R.string.delete:
pvMoreControlDelete(vid,video.ytvid);
break;
default :
eAssert(false);
}
}
}
);
builder.create().show();
}

Fixed version (ground truth):
private void pvOnMoreButtonClicked(View v){
  final YTPlayer.Video video=mMp.getActiveVideo();
  if (null == video)   return;
  final int[] opts;
  final Long vid=(Long)mDb.getVideoInfo(video.ytvid,ColVideo.ID);
  if (null != vid)   opts=new int[]{R.string.detail_info,R.string.set_bookmark,R.string.bookmarks,R.string.add_to,R.string.volume,R.string.delete};
 else   opts=new int[]{R.string.add_to,R.string.volume};
  final CharSequence[] items=new CharSequence[opts.length];
  for (int i=0; i < opts.length; i++)   items[i]=Utils.getResText(opts[i]);
  AlertDialog.Builder builder=new AlertDialog.Builder(mVActivity);
  builder.setTitle(R.string.player_extra_control_title);
  builder.setItems(items,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int item){
switch (opts[item]) {
case R.string.detail_info:
        pvMoreControlDetailInfo(vid);
      break;
case R.string.set_bookmark:
    pvMoreControlSetBookmark(vid);
  break;
case R.string.bookmarks:
UiUtils.showBookmarkDialog(mVActivity,video.ytvid,video.title);
break;
case R.string.add_to:
pvMoreControlAddTo(vid,video);
break;
case R.string.volume:
changeVideoVolume(video.title,video.ytvid);
break;
case R.string.delete:
pvMoreControlDelete(vid,video.ytvid);
break;
default :
eAssert(false);
}
}
}
);
builder.create().show();
}
Program: 110002
Project: 110002
Buggy source:
@Override public void onDrawerOpened(){
  if (!mMp.hasActiveVideo())   return;
  ListView lv=(ListView)mPlayerLDrawer.findViewById(R.id.mplayer_list);
  int topPos=mMp.getActiveVideoIndex() - 1;
  if (topPos < 0)   topPos=0;
  lv.setSelectionFromTop(topPos,0);
}

Fixed version (ground truth):
@Override public void onDrawerOpened(){
  if (!mMp.hasActiveVideo() || null == mPlayerLDrawer)   return;
  ListView lv=(ListView)mPlayerLDrawer.findViewById(R.id.mplayer_list);
  int topPos=mMp.getActiveVideoIndex() - 1;
  if (topPos < 0)   topPos=0;
  lv.setSelectionFromTop(topPos,0);
}
Program: 110004
Project: 110004
Buggy source:
private void pvOnMoreButtonClicked(View v){
  final YTPlayer.Video video=mMp.getActiveVideo();
  final int[] opts;
  final Long vid=(Long)mDb.getVideoInfo(video.ytvid,ColVideo.ID);
  if (null != vid)   opts=new int[]{R.string.detail_info,R.string.set_bookmark,R.string.bookmarks,R.string.add_to,R.string.volume,R.string.delete};
 else   opts=new int[]{R.string.add_to,R.string.delete,R.string.volume};
  final CharSequence[] items=new CharSequence[opts.length];
  for (int i=0; i < opts.length; i++)   items[i]=Utils.getResText(opts[i]);
  AlertDialog.Builder builder=new AlertDialog.Builder(mVActivity);
  builder.setTitle(R.string.player_extra_control_title);
  builder.setItems(items,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int item){
switch (opts[item]) {
case R.string.detail_info:
        pvMoreControlDetailInfo(vid);
      break;
case R.string.set_bookmark:
    pvMoreControlSetBookmark(vid);
  break;
case R.string.bookmarks:
UiUtils.showBookmarkDialog(mVActivity,video.ytvid,video.title);
break;
case R.string.add_to:
pvMoreControlAddTo(vid,video);
break;
case R.string.volume:
changeVideoVolume(video.title,video.ytvid);
break;
case R.string.delete:
pvMoreControlDelete(vid,video.ytvid);
break;
default :
eAssert(false);
}
}
}
);
builder.create().show();
}

Fixed version (ground truth):
private void pvOnMoreButtonClicked(View v){
  final YTPlayer.Video video=mMp.getActiveVideo();
  if (null == video)   return;
  final int[] opts;
  final Long vid=(Long)mDb.getVideoInfo(video.ytvid,ColVideo.ID);
  if (null != vid)   opts=new int[]{R.string.detail_info,R.string.set_bookmark,R.string.bookmarks,R.string.add_to,R.string.volume,R.string.delete};
 else   opts=new int[]{R.string.add_to,R.string.delete,R.string.volume};
  final CharSequence[] items=new CharSequence[opts.length];
  for (int i=0; i < opts.length; i++)   items[i]=Utils.getResText(opts[i]);
  AlertDialog.Builder builder=new AlertDialog.Builder(mVActivity);
  builder.setTitle(R.string.player_extra_control_title);
  builder.setItems(items,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int item){
switch (opts[item]) {
case R.string.detail_info:
        pvMoreControlDetailInfo(vid);
      break;
case R.string.set_bookmark:
    pvMoreControlSetBookmark(vid);
  break;
case R.string.bookmarks:
UiUtils.showBookmarkDialog(mVActivity,video.ytvid,video.title);
break;
case R.string.add_to:
pvMoreControlAddTo(vid,video);
break;
case R.string.volume:
changeVideoVolume(video.title,video.ytvid);
break;
case R.string.delete:
pvMoreControlDelete(vid,video.ytvid);
break;
default :
eAssert(false);
}
}
}
);
builder.create().show();
}
Program: 110005
Project: 110005
Buggy source:
void playerStop(){
  mpStop();
}

Fixed version (ground truth):
void playerStop(){
  if (null != mYtHack)   mYtHack.forceCancel();
  mpStop();
}
Program: 110007
Project: 110007
Buggy source:
public final boolean cancel(final boolean interrupt){
  if (mCancelled.getAndSet(true) || State.RUNNING != mState.get())   return false;
  mOwner.post(new Runnable(){
    @Override public void run(){
      onCancel();
synchronized (mPostRunKeeperLock) {
        if (interrupt && State.RUNNING == mState.get())         mThread.interrupt();
      }
    }
  }
);
  return true;
}

Fixed version (ground truth):
/** 
 * @param interrupt
 * @return 'false' if task is already cancelled - cancel() is called more than once!
 */
public final boolean cancel(final boolean interrupt){
  if (mUserCancel.getAndSet(true))   return false;
  mOwner.post(new Runnable(){
    @Override public void run(){
synchronized (mStateLock) {
switch (getStateLocked()) {
case STARTED:
case RUNNING:
          setStateLocked(State.CANCELING);
        if (DBG)         P.v("String_Node_Str");
      onCancel();
    if (interrupt)     mThread.interrupt();
  break;
default :
}
}
}
}
);
return true;
}
Program: 110008
Project: 110008
Buggy source:
public final boolean isCancelled(){
  return mCancelled.get();
}

Fixed version (ground truth):
/** 
 * Is task cancelled by user? (by calling 'cancel()') This function returns 'true' even if task is under CANCELING state.
 * @return
 */
public final boolean isCancelled(){
  return mUserCancel.get();
}
Program: 110009
Project: 110009
Buggy source:
@Override public void run(){
  onPreRun();
  mThread.start();
}

Fixed version (ground truth):
@Override public void run(){
  boolean canRun=false;
synchronized (mStateLock) {
    if (State.READY == getStateLocked()) {
      setStateLocked(State.STARTED);
      canRun=true;
    }
  }
  if (canRun) {
    onPreRun();
    mThread.start();
  }
}
Program: 110010
Project: 110010
Buggy source:
private void postOnCancelled(){
  mOwner.post(new Runnable(){
    @Override public void run(){
      onCancelled();
      mState.set(State.TERMINATED);
    }
  }
);
}

Fixed version (ground truth):
private void postOnCancelled(){
  if (DBG)   P.v("String_Node_Str");
  mOwner.post(new Runnable(){
    @Override public void run(){
      onCancelled();
synchronized (mStateLock) {
        setStateLocked(State.TERMINATED_CANCELLED);
      }
    }
  }
);
}
Program: 110011
Project: 110011
Buggy source:
private void postOnPostRun(final R r){
  mOwner.post(new Runnable(){
    @Override public void run(){
      onPostRun(r);
      mState.set(State.TERMINATED);
    }
  }
);
}

Fixed version (ground truth):
private void postOnPostRun(final R r){
  if (DBG)   P.v("String_Node_Str");
  mOwner.post(new Runnable(){
    @Override public void run(){
      onPostRun(r);
synchronized (mStateLock) {
        setStateLocked(State.TERMINATED);
      }
    }
  }
);
}
Program: 110012
Project: 110012
Buggy source:
private void bgRun(){
  R r=null;
  try {
    mState.set(State.RUNNING);
    if (mCancelled.get())     return;
    r=doAsyncTask();
  }
  finally {
synchronized (mPostRunKeeperLock) {
      mState.set(State.DONE);
      if (mCancelled.get())       postOnCancelled();
 else       postOnPostRun(r);
    }
  }
}

Fixed version (ground truth):
private void bgRun(){
  R r=null;
  try {
synchronized (mStateLock) {
switch (getStateLocked()) {
case CANCELING:
        return;
case STARTED:
      setStateLocked(State.RUNNING);
    break;
default :
  if (DBG)   P.w("String_Node_Str" + getStateLocked().name() + "String_Node_Str");
return;
}
}
r=doAsyncTask();
}
  finally {
synchronized (mStateLock) {
switch (getStateLocked()) {
case CANCELING:
setStateLocked(State.CANCELLED);
postOnCancelled();
break;
case RUNNING:
setStateLocked(State.DONE);
postOnPostRun(r);
break;
default :
;
}
}
}
}
Program: 110013
Project: 110013
Buggy source:
public final State getState(){
  return mState.get();
}

Fixed version (ground truth):
public final State getState(){
synchronized (mStateLock) {
    return getStateLocked();
  }
}
Program: 110014
Project: 110014
Buggy source:
@Override public void onDbUpdated(YTPlayer.DBUpdateType ty){
switch (ty) {
case PLAYLIST:
    showLoadingLookAndFeel();
  checkDupAsync(null,(YTVideoFeed.Entry[])getAdapter().getEntries());
}
}

Fixed version (ground truth):
@Override public void onDbUpdated(YTPlayer.DBUpdateType ty){
switch (ty) {
case PLAYLIST:
    showLoadingLookAndFeel();
  YTVideoSearchAdapter adapter=getAdapter();
if (null != adapter) checkDupAsync(null,(YTVideoFeed.Entry[])adapter.getEntries());
}
}
Program: 110015
Project: 110015
Buggy source:
@Override protected Err doAsyncTask(){
  Err ret=Err.NO_ERR;
  if (null != mWorker)   ret=mWorker.doBackgroundWork(this);
  return ret;
}

Fixed version (ground truth):
@Override protected Err doAsyncTask(){
  try {
    Err ret=Err.NO_ERR;
    if (null != mWorker)     ret=mWorker.doBackgroundWork(this);
    return ret;
  }
 catch (  Throwable e) {
    return Err.UNKNOWN;
  }
}
Program: 110016
Project: 110016
Buggy source:
@Override public Integer doJob(){
  if (insertVideoToPlaylist(plid,e))   mtpr.nrDone.incrementAndGet();
 else   mtpr.nrIgnored.incrementAndGet();
  return 0;
}

Fixed version (ground truth):
@Override public Integer doJob(){
  boolean r=false;
  try {
    r=insertVideoToPlaylist(plid,e);
    return 0;
  }
  finally {
    if (r)     mtpr.nrDone.incrementAndGet();
 else     mtpr.nrIgnored.incrementAndGet();
  }
}
Program: 110018
Project: 110018
Buggy source:
@Override protected R doAsyncTask(){
  R r=_mJob.doJob();
  return r;
}

Fixed version (ground truth):
@Override protected R doAsyncTask(){
  R r=null;
  r=_mJob.doJob();
  return r;
}
Program: 110019
Project: 110019
Buggy source:
@Override public Integer doJob(){
  LoadThumbnailReturn r=doLoadThumbnail(arg);
  sendLoadThumbnailDone(arg,r.bm,r.err);
  return 0;
}

Fixed version (ground truth):
@Override public Integer doJob(){
  LoadThumbnailReturn r=null;
  try {
    r=doLoadThumbnail(arg);
  }
  finally {
    if (null == r)     sendLoadThumbnailDone(arg,null,YTSearchHelper.Err.UNKNOWN);
 else     sendLoadThumbnailDone(arg,r.bm,r.err);
  }
  return 0;
}
Program: 110020
Project: 110020
Buggy source:
@Override public void handleMessage(final Message msg){
  if (_mClosed)   return;
switch (msg.what) {
case MSG_WHAT_OPEN:
{
      eAssert(null == _mMtrunner);
      _mMtrunner=new MultiThreadRunner(this,Policy.YTSEARCH_MAX_LOAD_THUMBNAIL_THREAD);
    }
  break;
case MSG_WHAT_CLOSE:
{
  _mClosed=true;
  ((HandlerThread)getLooper().getThread()).quit();
}
break;
case MSG_WHAT_SEARCH:
{
SearchArg arg=(SearchArg)msg.obj;
SearchReturn r=doSearch(arg);
sendFeedDone(arg,r.r,r.err);
}
break;
case MSG_WHAT_LOAD_THUMBNAIL:
{
final LoadThumbnailArg arg=(LoadThumbnailArg)msg.obj;
MultiThreadRunner.Job<Integer> job=new MultiThreadRunner.Job<Integer>(true,0){
@Override public Integer doJob(){
LoadThumbnailReturn r=doLoadThumbnail(arg);
sendLoadThumbnailDone(arg,r.bm,r.err);
return 0;
}
}
;
_mMtrunner.appendJob(job);
}
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(final Message msg){
  if (_mClosed)   return;
switch (msg.what) {
case MSG_WHAT_OPEN:
{
      eAssert(null == _mMtrunner);
      _mMtrunner=new MultiThreadRunner(this,Policy.YTSEARCH_MAX_LOAD_THUMBNAIL_THREAD);
    }
  break;
case MSG_WHAT_CLOSE:
{
  _mClosed=true;
  ((HandlerThread)getLooper().getThread()).quit();
}
break;
case MSG_WHAT_SEARCH:
{
SearchArg arg=(SearchArg)msg.obj;
SearchReturn r=doSearch(arg);
sendFeedDone(arg,r.r,r.err);
}
break;
case MSG_WHAT_LOAD_THUMBNAIL:
{
final LoadThumbnailArg arg=(LoadThumbnailArg)msg.obj;
MultiThreadRunner.Job<Integer> job=new MultiThreadRunner.Job<Integer>(true,0){
@Override public Integer doJob(){
LoadThumbnailReturn r=null;
try {
r=doLoadThumbnail(arg);
}
  finally {
if (null == r) sendLoadThumbnailDone(arg,null,YTSearchHelper.Err.UNKNOWN);
 else sendLoadThumbnailDone(arg,r.bm,r.err);
}
return 0;
}
}
;
_mMtrunner.appendJob(job);
}
break;
}
}
Program: 110021
Project: 110021
Buggy source:
YTSearchAdapter(Context context,YTSearchHelper helper,int rowLayout,YTFeed.Entry[] entries){
  super();
  mCxt=context;
  mHelper=helper;
  mEntries=entries;
  mItemViews=new View[mEntries.length];
  mThumbnails=new Bitmap[mEntries.length];
  mHelper.setLoadThumbnailDoneRecevier(this);
  long delay=0;
  for (int i=0; i < mItemViews.length; i++) {
    mItemViews[i]=UiUtils.inflateLayout(Utils.getAppContext(),rowLayout);
    UiUtils.setThumbnailImageView((ImageView)mItemViews[i].findViewById(R.id.thumbnail),null);
    setViewInvalid(mItemViews[i]);
    final YTSearchHelper.LoadThumbnailArg arg=new YTSearchHelper.LoadThumbnailArg(i,mEntries[i].media.thumbnailUrl,mCxt.getResources().getDimensionPixelSize(R.dimen.thumbnail_width),mCxt.getResources().getDimensionPixelSize(R.dimen.thumbnail_height));
    mThumbnails[i]=null;
    Utils.getUiHandler().postDelayed(new Runnable(){
      @Override public void run(){
        if (null != mHelper)         mHelper.loadThumbnailAsync(arg);
      }
    }
,delay);
    delay+=Policy.YTSEARCH_LOAD_THUMBNAIL_INTERVAL;
  }
}

Fixed version (ground truth):
YTSearchAdapter(Context context,YTSearchHelper helper,int rowLayout,YTFeed.Entry[] entries){
  super();
  mCxt=context;
  mHelper=helper;
  mEntries=entries;
  mItemViews=new View[mEntries.length];
  mThumbnails=new Bitmap[mEntries.length];
  mHelper.setLoadThumbnailDoneRecevier(this);
  for (int i=0; i < mItemViews.length; i++) {
    mItemViews[i]=UiUtils.inflateLayout(Utils.getAppContext(),rowLayout);
    UiUtils.setThumbnailImageView((ImageView)mItemViews[i].findViewById(R.id.thumbnail),null);
    setViewInvalid(mItemViews[i]);
    final YTSearchHelper.LoadThumbnailArg arg=new YTSearchHelper.LoadThumbnailArg(i,mEntries[i].media.thumbnailUrl,mCxt.getResources().getDimensionPixelSize(R.dimen.thumbnail_width),mCxt.getResources().getDimensionPixelSize(R.dimen.thumbnail_height));
    mThumbnails[i]=null;
    if (null != mHelper)     mHelper.loadThumbnailAsync(arg);
  }
}
Program: 110022
Project: 110022
Buggy source:
public void loadThumbnailAsync(LoadThumbnailArg arg){
  Message msg=mBgHandler.obtainMessage(MSG_WHAT_LOAD_THUMBNAIL,arg);
  mBgHandler.sendMessage(msg);
}

Fixed version (ground truth):
public void loadThumbnailAsync(LoadThumbnailArg arg){
  if (null == mBgHandler)   return;
  Message msg=mBgHandler.obtainMessage(MSG_WHAT_LOAD_THUMBNAIL,arg);
  mBgHandler.sendMessage(msg);
}
Program: 110023
Project: 110023
Buggy source:
/** 
 * This function download thumbnail image through network synchronously.
 */
public static boolean insertVideoToPlaylist(long plid,String ytvid,String title,String author,int playtime,int volume){
  YTSearchHelper.LoadThumbnailReturn tr=loadYtVideoThumbnail(ytvid);
  DB.Err err=DB.get().insertVideoToPlaylist(plid,ytvid,title,author,playtime,ImageUtils.compressBitmap(tr.bm),Policy.DEFAULT_VIDEO_VOLUME);
  if (null != tr.bm)   tr.bm.recycle();
  if (DB.Err.NO_ERR != err)   return false;
  return true;
}

Fixed version (ground truth):
/** 
 * This function download thumbnail image through network synchronously.
 */
public static boolean insertVideoToPlaylist(long plid,String ytvid,String title,String author,int playtime,int volume){
  YTSearchHelper.LoadThumbnailReturn tr=loadYtVideoThumbnail(ytvid);
  if (null == tr.bm)   return false;
  DB.Err err=DB.get().insertVideoToPlaylist(plid,ytvid,title,author,playtime,ImageUtils.compressBitmap(tr.bm),Policy.DEFAULT_VIDEO_VOLUME);
  tr.bm.recycle();
  if (DB.Err.NO_ERR != err)   return false;
  return true;
}
Program: 110025
Project: 110025
Buggy source:
YTSearchAdapter(Context context,YTSearchHelper helper,int rowLayout,YTFeed.Entry[] entries){
  super();
  mCxt=context;
  mHelper=helper;
  mEntries=entries;
  mItemViews=new View[mEntries.length];
  mThumbnails=new Bitmap[mEntries.length];
  mHelper.setLoadThumbnailDoneRecevier(this);
  long delay=0;
  for (int i=0; i < mItemViews.length; i++) {
    mItemViews[i]=UiUtils.inflateLayout(Utils.getAppContext(),rowLayout);
    setViewInvalid(mItemViews[i]);
    final YTSearchHelper.LoadThumbnailArg arg=new YTSearchHelper.LoadThumbnailArg(i,mEntries[i].media.thumbnailUrl,mCxt.getResources().getDimensionPixelSize(R.dimen.thumbnail_width),mCxt.getResources().getDimensionPixelSize(R.dimen.thumbnail_height));
    mThumbnails[i]=null;
    Utils.getUiHandler().postDelayed(new Runnable(){
      @Override public void run(){
        if (null != mHelper)         mHelper.loadThumbnailAsync(arg);
      }
    }
,delay);
    delay+=Policy.YTSEARCH_LOAD_THUMBNAIL_INTERVAL;
  }
}

Fixed version (ground truth):
YTSearchAdapter(Context context,YTSearchHelper helper,int rowLayout,YTFeed.Entry[] entries){
  super();
  mCxt=context;
  mHelper=helper;
  mEntries=entries;
  mItemViews=new View[mEntries.length];
  mThumbnails=new Bitmap[mEntries.length];
  mHelper.setLoadThumbnailDoneRecevier(this);
  long delay=0;
  for (int i=0; i < mItemViews.length; i++) {
    mItemViews[i]=UiUtils.inflateLayout(Utils.getAppContext(),rowLayout);
    UiUtils.setThumbnailImageView((ImageView)mItemViews[i].findViewById(R.id.thumbnail),null);
    setViewInvalid(mItemViews[i]);
    final YTSearchHelper.LoadThumbnailArg arg=new YTSearchHelper.LoadThumbnailArg(i,mEntries[i].media.thumbnailUrl,mCxt.getResources().getDimensionPixelSize(R.dimen.thumbnail_width),mCxt.getResources().getDimensionPixelSize(R.dimen.thumbnail_height));
    mThumbnails[i]=null;
    Utils.getUiHandler().postDelayed(new Runnable(){
      @Override public void run(){
        if (null != mHelper)         mHelper.loadThumbnailAsync(arg);
      }
    }
,delay);
    delay+=Policy.YTSEARCH_LOAD_THUMBNAIL_INTERVAL;
  }
}
Program: 110026
Project: 110026
Buggy source:
@Override protected void setItemView(int position,View v,YTFeed.Entry arge){
  eAssert(null != v);
  if (!arge.available)   v.setVisibility(View.INVISIBLE);
  YTVideoFeed.Entry e=(YTVideoFeed.Entry)arge;
  TextView titlev=(TextView)v.findViewById(R.id.title);
  titlev.setText(arge.media.title);
  ImageView thumbnailv=(ImageView)v.findViewById(R.id.thumbnail);
  UiUtils.setThumbnailImageView(thumbnailv,null);
  String playtmtext="String_Node_Str";
  try {
    playtmtext=Utils.secsToMinSecText(Integer.parseInt(e.media.playTime));
  }
 catch (  NumberFormatException ex) {
  }
  ((TextView)v.findViewById(R.id.playtime)).setText(playtmtext);
  String dateText;
  dateText=e.media.uploadedTime;
  Date date=Utils.parseDateString(dateText);
  if (null != date)   dateText=android.text.format.DateFormat.getDateFormat(mCxt).format(date);
  ((TextView)v.findViewById(R.id.uploadedtime)).setText("String_Node_Str" + dateText + "String_Node_Str");
  ((TextView)v.findViewById(R.id.author)).setText(e.author.name);
  if (mDupSet.contains(position))   setToDup(v);
 else   setToNew(v);
  setViewValid(v);
}

Fixed version (ground truth):
@Override protected void setItemView(int position,View v,YTFeed.Entry arge){
  eAssert(null != v);
  if (!arge.available)   v.setVisibility(View.INVISIBLE);
  YTVideoFeed.Entry e=(YTVideoFeed.Entry)arge;
  TextView titlev=(TextView)v.findViewById(R.id.title);
  titlev.setText(arge.media.title);
  String playtmtext="String_Node_Str";
  try {
    playtmtext=Utils.secsToMinSecText(Integer.parseInt(e.media.playTime));
  }
 catch (  NumberFormatException ex) {
  }
  ((TextView)v.findViewById(R.id.playtime)).setText(playtmtext);
  String dateText;
  dateText=e.media.uploadedTime;
  Date date=Utils.parseDateString(dateText);
  if (null != date)   dateText=android.text.format.DateFormat.getDateFormat(mCxt).format(date);
  ((TextView)v.findViewById(R.id.uploadedtime)).setText("String_Node_Str" + dateText + "String_Node_Str");
  ((TextView)v.findViewById(R.id.author)).setText(e.author.name);
  if (mDupSet.contains(position))   setToDup(v);
 else   setToNew(v);
  setViewValid(v);
}
Program: 110027
Project: 110027
Buggy source:
/** 
 * This function is a kind of HACK to save memory used by thumbnail. Very dangerous and difficult at maintenance. But, I failed to find any better way to save memory for thumbnail display. NOTE If exception like "Exception : try to used recycled bitmap ..." is shown up, read and understand what this function does with highest priority!
 * @param v
 * @param imgdata
 */
public static void setThumbnailImageView(ImageView v,byte[] imgdata){
  Bitmap thumbnailBm;
  if (null != imgdata && imgdata.length > 0)   thumbnailBm=BitmapFactory.decodeByteArray(imgdata,0,imgdata.length);
 else   thumbnailBm=BitmapFactory.decodeResource(Utils.getAppContext().getResources(),R.drawable.ic_unknown_image);
  Drawable drawable=v.getDrawable();
  if (drawable instanceof BitmapDrawable) {
    BitmapDrawable bmd=(BitmapDrawable)drawable;
    Bitmap bitmap=bmd.getBitmap();
    bitmap.recycle();
  }
  v.setImageBitmap(thumbnailBm);
}

Fixed version (ground truth):
/** 
 * This function is a kind of HACK - actually FULL OF HACK - to save memory used by thumbnail. Very dangerous and difficult at maintenance. But, I failed to find any better way to save memory for thumbnail display. NOTE If exception like "Exception : try to used recycled bitmap ..." is shown up, read and understand what this function does with highest priority!
 * @param v
 * @param imgdata
 */
public static void setThumbnailImageView(ImageView v,byte[] imgdata){
  Bitmap thumbnailBm;
  if (null != imgdata && imgdata.length > 0)   thumbnailBm=BitmapFactory.decodeByteArray(imgdata,0,imgdata.length);
 else   thumbnailBm=sBmIcUnknownImage;
  Drawable drawable=v.getDrawable();
  if (drawable instanceof BitmapDrawable) {
    BitmapDrawable bmd=(BitmapDrawable)drawable;
    Bitmap bitmap=bmd.getBitmap();
    if (bitmap != sBmIcUnknownImage)     bitmap.recycle();
  }
  v.setImageBitmap(thumbnailBm);
}
Program: 110028
Project: 110028
Buggy source:
@Override public void bindView(View v,Context context,Cursor cur){
  ImageView checkv=(ImageView)v.findViewById(R.id.checkbtn);
  ImageView thumbnailv=(ImageView)v.findViewById(R.id.thumbnail);
  TextView titlev=(TextView)v.findViewById(R.id.title);
  TextView authorv=(TextView)v.findViewById(R.id.author);
  TextView playtmv=(TextView)v.findViewById(R.id.playtime);
  TextView uploadtmv=(TextView)v.findViewById(R.id.uploadedtime);
  int pos=cur.getPosition();
  checkv.setTag(VTAGKEY_POS,pos);
  checkv.setOnClickListener(mItemCheckOnClick);
  if (mCheckedMap.containsKey(pos))   checkv.setImageResource(R.drawable.btncheck_on);
 else   checkv.setImageResource(R.drawable.btncheck_off);
  titlev.setText(cur.getString(COLI_TITLE));
  String author=cur.getString(COLI_AUTHOR);
  if (Utils.isValidValue(author))   authorv.setText(author);
 else   authorv.setVisibility(View.GONE);
  uploadtmv.setVisibility(View.GONE);
  playtmv.setText(Utils.secsToMinSecText(cur.getInt(COLI_PLAYTIME)));
  byte[] thumbnailData=(byte[])DB.get().getVideoInfo(cur.getString(COLI_VIDEOID),ColVideo.THUMBNAIL);
  UiUtils.setThumbnailImageView(thumbnailv,thumbnailData);
}

Fixed version (ground truth):
@Override public void bindView(View v,Context context,Cursor cur){
  ImageView checkv=(ImageView)v.findViewById(R.id.checkbtn);
  ImageView thumbnailv=(ImageView)v.findViewById(R.id.thumbnail);
  TextView titlev=(TextView)v.findViewById(R.id.title);
  TextView authorv=(TextView)v.findViewById(R.id.author);
  TextView playtmv=(TextView)v.findViewById(R.id.playtime);
  TextView uploadtmv=(TextView)v.findViewById(R.id.uploadedtime);
  int pos=cur.getPosition();
  checkv.setTag(VTAGKEY_POS,pos);
  checkv.setOnClickListener(mItemCheckOnClick);
  if (mCheckedMap.containsKey(pos))   checkv.setImageResource(R.drawable.btncheck_on);
 else   checkv.setImageResource(R.drawable.btncheck_off);
  titlev.setText(cur.getString(COLI_TITLE));
  String author=cur.getString(COLI_AUTHOR);
  if (Utils.isValidValue(author)) {
    authorv.setVisibility(View.VISIBLE);
    authorv.setText(author);
  }
 else   authorv.setVisibility(View.GONE);
  uploadtmv.setVisibility(View.GONE);
  playtmv.setText(Utils.secsToMinSecText(cur.getInt(COLI_PLAYTIME)));
  byte[] thumbnailData=(byte[])DB.get().getVideoInfo(cur.getString(COLI_VIDEOID),ColVideo.THUMBNAIL);
  UiUtils.setThumbnailImageView(thumbnailv,thumbnailData);
}
Program: 110029
Project: 110029
Buggy source:
private void addTo(final int[] poss,final boolean move){
  long plid=UiUtils.isUserPlaylist(mPlid) ? mPlid : DB.INVALID_PLAYLIST_ID;
  MusicsAdapter adpr=getAdapter();
  final long[] mids=new long[poss.length];
  for (int i=0; i < mids.length; i++)   mids[i]=adpr.getItemId(poss[i]);
  UiUtils.OnPostExecuteListener listener=new UiUtils.OnPostExecuteListener(){
    @Override public void onPostExecute(    Err result,    Object user){
      if (Err.NO_ERR != result)       UiUtils.showTextToast(MusicsActivity.this,result.getMessage());
      if (move)       getAdapter().reloadCursorAsync();
 else {
        getAdapter().clearCheckState();
        getAdapter().notifyDataSetChanged();
      }
    }
  }
;
  UiUtils.addVideosTo(this,null,listener,plid,mids,move);
}

Fixed version (ground truth):
private void addTo(final int[] poss,final boolean move){
  MusicsAdapter adpr=getAdapter();
  final long[] mids=new long[poss.length];
  for (int i=0; i < mids.length; i++)   mids[i]=adpr.getItemId(poss[i]);
  UiUtils.OnPostExecuteListener listener=new UiUtils.OnPostExecuteListener(){
    @Override public void onPostExecute(    Err result,    Object user){
      if (Err.NO_ERR != result)       UiUtils.showTextToast(MusicsActivity.this,result.getMessage());
      if (move)       getAdapter().reloadCursorAsync();
 else {
        getAdapter().clearCheckState();
        getAdapter().notifyDataSetChanged();
      }
    }
  }
;
  UiUtils.addVideosTo(this,null,listener,mPlid,mids,move);
}