nus-yam/ex-repair huggingface dataset:
Program: 2856
Project: 2856
Buggy source:
public static void index(String language,String defaultLanguage){
  if (StringUtils.isBlank(defaultLanguage)) {
    defaultLanguage=Play.langs.get(0);
  }
  if (StringUtils.isBlank(language)) {
    language=defaultLanguage;
  }
  File workingFile=ApplicationMessages.getWorkingFile(language);
  Properties localizations;
  if (workingFile.exists()) {
    localizations=ApplicationMessages.readUtf8Properties(workingFile);
  }
 else {
    localizations=Messages.all(language);
  }
  Properties defaultLocalizations=Messages.all(defaultLanguage);
  SourceMessageKeys sources=ApplicationMessages.lookUp();
  List<String> newKeys=ApplicationMessages.findNewKeys(sources,localizations);
  List<String> obsoleteKeys=ApplicationMessages.findObsoleteKeys(sources,localizations);
  List<String> existingKeys=ApplicationMessages.findExistingKeys(sources,localizations);
  List<String> keepList=ApplicationMessages.readKeys(ApplicationMessages.getKeepFile());
  obsoleteKeys.removeAll(keepList);
  existingKeys.addAll(keepList);
  List<String> ignoreList=ApplicationMessages.readKeys(ApplicationMessages.getIgnoreFile());
  render(workingFile,language,defaultLanguage,localizations,defaultLocalizations,sources,newKeys,existingKeys,obsoleteKeys,keepList,ignoreList);
}

Fixed version (ground truth):
public static void index(String language,String defaultLanguage){
  if (StringUtils.isBlank(defaultLanguage)) {
    defaultLanguage=Play.langs.get(0);
  }
  if (StringUtils.isBlank(language)) {
    language=defaultLanguage;
  }
  File workingFile=ApplicationMessages.getWorkingFile(language);
  Properties localizations;
  if (workingFile.exists()) {
    localizations=ApplicationMessages.readUtf8Properties(workingFile);
  }
 else {
    localizations=Messages.all(language);
  }
  Properties defaultLocalizations=Messages.all(defaultLanguage);
  SourceMessageKeys sources=ApplicationMessages.lookUp();
  List<String> newKeys=ApplicationMessages.findNewKeys(sources,localizations);
  List<String> obsoleteKeys=ApplicationMessages.findObsoleteKeys(sources,localizations);
  List<String> existingKeys=ApplicationMessages.findExistingKeys(sources,localizations);
  List<String> keepList=ApplicationMessages.readKeys(ApplicationMessages.getKeepFile());
  List<String> ignoreList=ApplicationMessages.readKeys(ApplicationMessages.getIgnoreFile());
  obsoleteKeys.removeAll(keepList);
  existingKeys.addAll(keepList);
  newKeys.removeAll(ignoreList);
  render(workingFile,language,defaultLanguage,localizations,defaultLocalizations,sources,newKeys,existingKeys,obsoleteKeys,keepList,ignoreList);
}
Program: 2857
Project: 2857
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
    final int uid=intent.getIntExtra(Intent.EXTRA_UID,-123);
    Api.applicationRemoved(context,uid);
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
    final boolean replacing=intent.getBooleanExtra(Intent.EXTRA_REPLACING,false);
    if (!replacing) {
      final int uid=intent.getIntExtra(Intent.EXTRA_UID,-123);
      Api.applicationRemoved(context,uid);
    }
  }
}
Program: 2858
Project: 2858
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
    final int uid=intent.getIntExtra(Intent.EXTRA_UID,-123);
    Api.applicationRemoved(context,uid);
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
    final boolean replacing=intent.getBooleanExtra(Intent.EXTRA_REPLACING,false);
    if (!replacing) {
      final int uid=intent.getIntExtra(Intent.EXTRA_UID,-123);
      Api.applicationRemoved(context,uid);
    }
  }
}
Program: 2859
Project: 2859
Buggy source:
/** 
 * Asserts that the binary files are installed in the cache directory.
 * @param ctx context
 * @param showErrors indicates if errors should be alerted
 * @return false if the binary files could not be installed
 */
public static boolean assertBinaries(Context ctx,boolean showErrors){
  boolean changed=false;
  try {
    File file=new File(ctx.getCacheDir(),"String_Node_Str");
    if (!file.exists()) {
      copyRawFile(ctx,R.raw.iptables_g1,file,"String_Node_Str");
      changed=true;
    }
    file=new File(ctx.getCacheDir(),"String_Node_Str");
    if (!file.exists()) {
      copyRawFile(ctx,R.raw.iptables_n1,file,"String_Node_Str");
      changed=true;
    }
    file=new File(ctx.getCacheDir(),"String_Node_Str");
    if (!file.exists()) {
      copyRawFile(ctx,R.raw.busybox_g1,file,"String_Node_Str");
      changed=true;
    }
    if (changed) {
      Toast.makeText(ctx,R.string.toast_bin_installed,Toast.LENGTH_LONG).show();
    }
  }
 catch (  Exception e) {
    if (showErrors)     alert(ctx,"String_Node_Str" + e);
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Asserts that the binary files are installed in the cache directory.
 * @param ctx context
 * @param showErrors indicates if errors should be alerted
 * @return false if the binary files could not be installed
 */
public static boolean assertBinaries(Context ctx,boolean showErrors){
  boolean changed=false;
  try {
    File file=new File(ctx.getCacheDir(),"String_Node_Str");
    if ((!file.exists()) && isARMv6()) {
      copyRawFile(ctx,R.raw.iptables_g1,file,"String_Node_Str");
      changed=true;
    }
    file=new File(ctx.getCacheDir(),"String_Node_Str");
    if ((!file.exists()) && (!isARMv6())) {
      copyRawFile(ctx,R.raw.iptables_n1,file,"String_Node_Str");
      changed=true;
    }
    file=new File(ctx.getCacheDir(),"String_Node_Str");
    if (!file.exists()) {
      copyRawFile(ctx,R.raw.busybox_g1,file,"String_Node_Str");
      changed=true;
    }
    if (changed) {
      Toast.makeText(ctx,R.string.toast_bin_installed,Toast.LENGTH_LONG).show();
    }
  }
 catch (  Exception e) {
    if (showErrors)     alert(ctx,"String_Node_Str" + e);
    return false;
  }
  return true;
}
Program: 2860
Project: 2860
Buggy source:
/** 
 * Create the generic shell script header used to determine which iptables binary to use.
 * @param ctx context
 * @return script header
 */
private static String scriptHeader(Context ctx){
  final String dir=ctx.getCacheDir().getAbsolutePath();
  return "String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + dir + "String_Node_Str"+ "String_Node_Str"+ dir+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ dir+ "String_Node_Str"+ "String_Node_Str"+ dir+ "String_Node_Str"+ "String_Node_Str"+ dir+ "String_Node_Str"+ "String_Node_Str"+ dir+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Create the generic shell script header used to determine which iptables binary to use.
 * @param ctx context
 * @return script header
 */
private static String scriptHeader(Context ctx){
  final String dir=ctx.getCacheDir().getAbsolutePath();
  final String myiptables=dir + (isARMv6() ? "String_Node_Str" : "String_Node_Str");
  return "String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + dir + "String_Node_Str"+ "String_Node_Str"+ dir+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ myiptables+ "String_Node_Str"+ "String_Node_Str"+ myiptables+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
}
Program: 2861
Project: 2861
Buggy source:
/** 
 * Apply or save iptable rules, showing a visual indication
 */
private void applyOrSaveRules(){
  final Resources res=getResources();
  final Handler handler;
  final boolean enabled=Api.isEnabled(this);
  progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(enabled ? R.string.applying_rules : R.string.saving_rules),true);
  handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (enabled) {
        Log.d("String_Node_Str","String_Node_Str");
        if (Api.hasRootAccess(MainActivity.this,true) && Api.applyIptablesRules(MainActivity.this,true)) {
          Toast.makeText(MainActivity.this,R.string.rules_applied,Toast.LENGTH_SHORT).show();
        }
 else {
          Log.d("String_Node_Str","String_Node_Str");
          Api.setEnabled(MainActivity.this,false);
        }
      }
 else {
        Log.d("String_Node_Str","String_Node_Str");
        Api.saveRules(MainActivity.this);
        Toast.makeText(MainActivity.this,R.string.rules_saved,Toast.LENGTH_SHORT).show();
      }
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}

Fixed version (ground truth):
/** 
 * Apply or save iptable rules, showing a visual indication
 */
private void applyOrSaveRules(){
  final Resources res=getResources();
  final boolean enabled=Api.isEnabled(this);
  final ProgressDialog progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(enabled ? R.string.applying_rules : R.string.saving_rules),true);
  final Handler handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (enabled) {
        Log.d("String_Node_Str","String_Node_Str");
        if (Api.hasRootAccess(MainActivity.this,true) && Api.applyIptablesRules(MainActivity.this,true)) {
          Toast.makeText(MainActivity.this,R.string.rules_applied,Toast.LENGTH_SHORT).show();
        }
 else {
          Log.d("String_Node_Str","String_Node_Str");
          Api.setEnabled(MainActivity.this,false);
        }
      }
 else {
        Log.d("String_Node_Str","String_Node_Str");
        Api.saveRules(MainActivity.this);
        Toast.makeText(MainActivity.this,R.string.rules_saved,Toast.LENGTH_SHORT).show();
      }
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}
Program: 2862
Project: 2862
Buggy source:
@Override protected void onStart(){
  super.onStart();
  Api.applications=null;
}

Fixed version (ground truth):
@Override protected void onStart(){
  super.onStart();
  Log.d("String_Node_Str","String_Node_Str");
  Api.applications=null;
}
Program: 2863
Project: 2863
Buggy source:
/** 
 * If the applications are cached, just show them, otherwise load and show
 */
private void showOrLoadApplications(){
  final Resources res=getResources();
  if (Api.applications == null) {
    progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.reading_apps),true);
    final Handler handler=new Handler(){
      public void handleMessage(      Message msg){
        if (progress != null)         progress.dismiss();
        showApplications();
      }
    }
;
    new Thread(){
      public void run(){
        Api.getApps(MainActivity.this);
        handler.sendEmptyMessage(0);
      }
    }
.start();
  }
 else {
    showApplications();
  }
}

Fixed version (ground truth):
/** 
 * If the applications are cached, just show them, otherwise load and show
 */
private void showOrLoadApplications(){
  final Resources res=getResources();
  if (Api.applications == null) {
    final ProgressDialog progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.reading_apps),true);
    final Handler handler=new Handler(){
      public void handleMessage(      Message msg){
        progress.dismiss();
        showApplications();
      }
    }
;
    new Thread(){
      public void run(){
        Api.getApps(MainActivity.this);
        handler.sendEmptyMessage(0);
      }
    }
.start();
  }
 else {
    showApplications();
  }
}
Program: 2864
Project: 2864
Buggy source:
/** 
 * Show iptable rules on a dialog
 */
private void showRules(){
  final Resources res=getResources();
  final Handler handler;
  progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.please_wait),true);
  handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (!Api.hasRootAccess(MainActivity.this,true))       return;
      Api.showIptablesRules(MainActivity.this);
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}

Fixed version (ground truth):
/** 
 * Show iptable rules on a dialog
 */
private void showRules(){
  final Resources res=getResources();
  final ProgressDialog progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.please_wait),true);
  final Handler handler=new Handler(){
    public void handleMessage(    Message msg){
      progress.dismiss();
      if (!Api.hasRootAccess(MainActivity.this,true))       return;
      Api.showIptablesRules(MainActivity.this);
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}
Program: 2865
Project: 2865
Buggy source:
/** 
 * Clear logs
 */
private void clearLog(){
  final Resources res=getResources();
  final Handler handler;
  progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.please_wait),true);
  handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (!Api.hasRootAccess(MainActivity.this,true))       return;
      if (Api.clearLog(MainActivity.this)) {
        Toast.makeText(MainActivity.this,R.string.log_cleared,Toast.LENGTH_SHORT).show();
      }
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}

Fixed version (ground truth):
/** 
 * Clear logs
 */
private void clearLog(){
  final Resources res=getResources();
  final ProgressDialog progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.please_wait),true);
  final Handler handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (!Api.hasRootAccess(MainActivity.this,true))       return;
      if (Api.clearLog(MainActivity.this)) {
        Toast.makeText(MainActivity.this,R.string.log_cleared,Toast.LENGTH_SHORT).show();
      }
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}
Program: 2866
Project: 2866
Buggy source:
/** 
 * Purge iptable rules, showing a visual indication
 */
private void purgeRules(){
  final Resources res=getResources();
  final Handler handler;
  progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.deleting_rules),true);
  handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (!Api.hasRootAccess(MainActivity.this,true))       return;
      if (Api.purgeIptables(MainActivity.this,true)) {
        Toast.makeText(MainActivity.this,R.string.rules_deleted,Toast.LENGTH_SHORT).show();
      }
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}

Fixed version (ground truth):
/** 
 * Purge iptable rules, showing a visual indication
 */
private void purgeRules(){
  final Resources res=getResources();
  final ProgressDialog progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.deleting_rules),true);
  final Handler handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (!Api.hasRootAccess(MainActivity.this,true))       return;
      if (Api.purgeIptables(MainActivity.this,true)) {
        Toast.makeText(MainActivity.this,R.string.rules_deleted,Toast.LENGTH_SHORT).show();
      }
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}
Program: 2867
Project: 2867
Buggy source:
/** 
 * Show logs on a dialog
 */
private void showLog(){
  final Resources res=getResources();
  final Handler handler;
  progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.please_wait),true);
  handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      Api.showLog(MainActivity.this);
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}

Fixed version (ground truth):
/** 
 * Show logs on a dialog
 */
private void showLog(){
  final Resources res=getResources();
  final ProgressDialog progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.please_wait),true);
  final Handler handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      Api.showLog(MainActivity.this);
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}
Program: 2868
Project: 2868
Buggy source:
/** 
 * Asserts that the binary files are installed in the cache directory.
 * @param ctx context
 * @param showErrors indicates if errors should be alerted
 * @return false if the binary files could not be installed
 */
public static boolean assertBinaries(Context ctx,boolean showErrors){
  boolean changed=false;
  try {
    File file=new File(ctx.getCacheDir(),"String_Node_Str");
    if (!file.exists()) {
      copyRawFile(ctx,R.raw.iptables_g1,file,"String_Node_Str");
      changed=true;
    }
    file=new File(ctx.getCacheDir(),"String_Node_Str");
    if (!file.exists()) {
      copyRawFile(ctx,R.raw.iptables_n1,file,"String_Node_Str");
      changed=true;
    }
    file=new File(ctx.getCacheDir(),"String_Node_Str");
    if (!file.exists()) {
      copyRawFile(ctx,R.raw.busybox_g1,file,"String_Node_Str");
      changed=true;
    }
    if (changed) {
      Toast.makeText(ctx,R.string.toast_bin_installed,Toast.LENGTH_LONG).show();
    }
  }
 catch (  Exception e) {
    if (showErrors)     alert(ctx,"String_Node_Str" + e);
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Asserts that the binary files are installed in the cache directory.
 * @param ctx context
 * @param showErrors indicates if errors should be alerted
 * @return false if the binary files could not be installed
 */
public static boolean assertBinaries(Context ctx,boolean showErrors){
  boolean changed=false;
  try {
    File file=new File(ctx.getCacheDir(),"String_Node_Str");
    if ((!file.exists()) && isARMv6()) {
      copyRawFile(ctx,R.raw.iptables_g1,file,"String_Node_Str");
      changed=true;
    }
    file=new File(ctx.getCacheDir(),"String_Node_Str");
    if ((!file.exists()) && (!isARMv6())) {
      copyRawFile(ctx,R.raw.iptables_n1,file,"String_Node_Str");
      changed=true;
    }
    file=new File(ctx.getCacheDir(),"String_Node_Str");
    if (!file.exists()) {
      copyRawFile(ctx,R.raw.busybox_g1,file,"String_Node_Str");
      changed=true;
    }
    if (changed) {
      Toast.makeText(ctx,R.string.toast_bin_installed,Toast.LENGTH_LONG).show();
    }
  }
 catch (  Exception e) {
    if (showErrors)     alert(ctx,"String_Node_Str" + e);
    return false;
  }
  return true;
}
Program: 2869
Project: 2869
Buggy source:
/** 
 * Create the generic shell script header used to determine which iptables binary to use.
 * @param ctx context
 * @return script header
 */
private static String scriptHeader(Context ctx){
  final String dir=ctx.getCacheDir().getAbsolutePath();
  return "String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + dir + "String_Node_Str"+ "String_Node_Str"+ dir+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ dir+ "String_Node_Str"+ "String_Node_Str"+ dir+ "String_Node_Str"+ "String_Node_Str"+ dir+ "String_Node_Str"+ "String_Node_Str"+ dir+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Create the generic shell script header used to determine which iptables binary to use.
 * @param ctx context
 * @return script header
 */
private static String scriptHeader(Context ctx){
  final String dir=ctx.getCacheDir().getAbsolutePath();
  final String myiptables=dir + (isARMv6() ? "String_Node_Str" : "String_Node_Str");
  return "String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + dir + "String_Node_Str"+ "String_Node_Str"+ dir+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ myiptables+ "String_Node_Str"+ "String_Node_Str"+ myiptables+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
}
Program: 2870
Project: 2870
Buggy source:
/** 
 * Apply or save iptable rules, showing a visual indication
 */
private void applyOrSaveRules(){
  final Resources res=getResources();
  final Handler handler;
  final boolean enabled=Api.isEnabled(this);
  progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(enabled ? R.string.applying_rules : R.string.saving_rules),true);
  handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (enabled) {
        Log.d("String_Node_Str","String_Node_Str");
        if (Api.hasRootAccess(MainActivity.this,true) && Api.applyIptablesRules(MainActivity.this,true)) {
          Toast.makeText(MainActivity.this,R.string.rules_applied,Toast.LENGTH_SHORT).show();
        }
 else {
          Log.d("String_Node_Str","String_Node_Str");
          Api.setEnabled(MainActivity.this,false);
        }
      }
 else {
        Log.d("String_Node_Str","String_Node_Str");
        Api.saveRules(MainActivity.this);
        Toast.makeText(MainActivity.this,R.string.rules_saved,Toast.LENGTH_SHORT).show();
      }
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}

Fixed version (ground truth):
/** 
 * Apply or save iptable rules, showing a visual indication
 */
private void applyOrSaveRules(){
  final Resources res=getResources();
  final boolean enabled=Api.isEnabled(this);
  final ProgressDialog progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(enabled ? R.string.applying_rules : R.string.saving_rules),true);
  final Handler handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (enabled) {
        Log.d("String_Node_Str","String_Node_Str");
        if (Api.hasRootAccess(MainActivity.this,true) && Api.applyIptablesRules(MainActivity.this,true)) {
          Toast.makeText(MainActivity.this,R.string.rules_applied,Toast.LENGTH_SHORT).show();
        }
 else {
          Log.d("String_Node_Str","String_Node_Str");
          Api.setEnabled(MainActivity.this,false);
        }
      }
 else {
        Log.d("String_Node_Str","String_Node_Str");
        Api.saveRules(MainActivity.this);
        Toast.makeText(MainActivity.this,R.string.rules_saved,Toast.LENGTH_SHORT).show();
      }
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}
Program: 2871
Project: 2871
Buggy source:
@Override protected void onStart(){
  super.onStart();
  Api.applications=null;
}

Fixed version (ground truth):
@Override protected void onStart(){
  super.onStart();
  Log.d("String_Node_Str","String_Node_Str");
  Api.applications=null;
}
Program: 2872
Project: 2872
Buggy source:
/** 
 * If the applications are cached, just show them, otherwise load and show
 */
private void showOrLoadApplications(){
  final Resources res=getResources();
  if (Api.applications == null) {
    progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.reading_apps),true);
    final Handler handler=new Handler(){
      public void handleMessage(      Message msg){
        if (progress != null)         progress.dismiss();
        showApplications();
      }
    }
;
    new Thread(){
      public void run(){
        Api.getApps(MainActivity.this);
        handler.sendEmptyMessage(0);
      }
    }
.start();
  }
 else {
    showApplications();
  }
}

Fixed version (ground truth):
/** 
 * If the applications are cached, just show them, otherwise load and show
 */
private void showOrLoadApplications(){
  final Resources res=getResources();
  if (Api.applications == null) {
    final ProgressDialog progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.reading_apps),true);
    final Handler handler=new Handler(){
      public void handleMessage(      Message msg){
        progress.dismiss();
        showApplications();
      }
    }
;
    new Thread(){
      public void run(){
        Api.getApps(MainActivity.this);
        handler.sendEmptyMessage(0);
      }
    }
.start();
  }
 else {
    showApplications();
  }
}
Program: 2873
Project: 2873
Buggy source:
/** 
 * Show iptable rules on a dialog
 */
private void showRules(){
  final Resources res=getResources();
  final Handler handler;
  progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.please_wait),true);
  handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (!Api.hasRootAccess(MainActivity.this,true))       return;
      Api.showIptablesRules(MainActivity.this);
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}

Fixed version (ground truth):
/** 
 * Show iptable rules on a dialog
 */
private void showRules(){
  final Resources res=getResources();
  final ProgressDialog progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.please_wait),true);
  final Handler handler=new Handler(){
    public void handleMessage(    Message msg){
      progress.dismiss();
      if (!Api.hasRootAccess(MainActivity.this,true))       return;
      Api.showIptablesRules(MainActivity.this);
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}
Program: 2874
Project: 2874
Buggy source:
/** 
 * Clear logs
 */
private void clearLog(){
  final Resources res=getResources();
  final Handler handler;
  progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.please_wait),true);
  handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (!Api.hasRootAccess(MainActivity.this,true))       return;
      if (Api.clearLog(MainActivity.this)) {
        Toast.makeText(MainActivity.this,R.string.log_cleared,Toast.LENGTH_SHORT).show();
      }
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}

Fixed version (ground truth):
/** 
 * Clear logs
 */
private void clearLog(){
  final Resources res=getResources();
  final ProgressDialog progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.please_wait),true);
  final Handler handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (!Api.hasRootAccess(MainActivity.this,true))       return;
      if (Api.clearLog(MainActivity.this)) {
        Toast.makeText(MainActivity.this,R.string.log_cleared,Toast.LENGTH_SHORT).show();
      }
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}
Program: 2875
Project: 2875
Buggy source:
/** 
 * Purge iptable rules, showing a visual indication
 */
private void purgeRules(){
  final Resources res=getResources();
  final Handler handler;
  progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.deleting_rules),true);
  handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (!Api.hasRootAccess(MainActivity.this,true))       return;
      if (Api.purgeIptables(MainActivity.this,true)) {
        Toast.makeText(MainActivity.this,R.string.rules_deleted,Toast.LENGTH_SHORT).show();
      }
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}

Fixed version (ground truth):
/** 
 * Purge iptable rules, showing a visual indication
 */
private void purgeRules(){
  final Resources res=getResources();
  final ProgressDialog progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.deleting_rules),true);
  final Handler handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      if (!Api.hasRootAccess(MainActivity.this,true))       return;
      if (Api.purgeIptables(MainActivity.this,true)) {
        Toast.makeText(MainActivity.this,R.string.rules_deleted,Toast.LENGTH_SHORT).show();
      }
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}
Program: 2876
Project: 2876
Buggy source:
/** 
 * Show logs on a dialog
 */
private void showLog(){
  final Resources res=getResources();
  final Handler handler;
  progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.please_wait),true);
  handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      Api.showLog(MainActivity.this);
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}

Fixed version (ground truth):
/** 
 * Show logs on a dialog
 */
private void showLog(){
  final Resources res=getResources();
  final ProgressDialog progress=ProgressDialog.show(this,res.getString(R.string.working),res.getString(R.string.please_wait),true);
  final Handler handler=new Handler(){
    public void handleMessage(    Message msg){
      if (progress != null)       progress.dismiss();
      Api.showLog(MainActivity.this);
    }
  }
;
  handler.sendEmptyMessageDelayed(0,100);
}
Program: 2879
Project: 2879
Buggy source:
public AnimationManager(){
  animationHandlerManager=new AnimationHandlerManager();
  animations=new ArrayList<Animation>();
}

Fixed version (ground truth):
public AnimationManager(){
  animationHandlerManager=new AnimationHandlerManager();
  animations=new ArrayList<Animation>();
  animationsToRemove=new ArrayList<Animation>();
}
Program: 2880
Project: 2880
Buggy source:
public void update(float delta){
  for (int i=0; i < animations.size(); i++)   animations.get(i).update(delta);
  animationHandlerManager.checkAnimationChanges();
}

Fixed version (ground truth):
public void update(float delta){
  for (int i=0; i < animations.size(); i++)   animations.get(i).update(delta);
  animationHandlerManager.checkAnimationChanges();
  for (int i=0; i < animationsToRemove.size(); i++) {
    Animation animation=animationsToRemove.get(i);
    animationHandlerManager.removeMonitorsFor(animation);
  }
  animations.remove(animationsToRemove);
  animationsToRemove.clear();
}
Program: 2881
Project: 2881
Buggy source:
public void remove(Animation animation){
  animations.remove(animation);
  animationHandlerManager.removeMonitorsFor(animation);
}

Fixed version (ground truth):
public void remove(Animation animation){
  animationsToRemove.add(animation);
}
Program: 2882
Project: 2882
Buggy source:
public void removeMonitorsFor(Animation animation){
  for (int i=0; i < animationMonitors.size(); i++) {
    if (animationMonitors.get(i).getAnimation() == animation)     animationMonitorsToRemove.add(animationMonitors.get(i));
  }
  animationMonitors.removeAll(animationMonitorsToRemove);
  animationMonitorsToRemove.clear();
}

Fixed version (ground truth):
public void removeMonitorsFor(Animation animation){
  for (int i=0; i < animationMonitors.size(); i++) {
    AnimationMonitor animationMonitor=animationMonitors.get(i);
    if (animationMonitor.getAnimation() == animation)     animationMonitorsToRemove.add(animationMonitor);
  }
  animationMonitors.removeAll(animationMonitorsToRemove);
  animationMonitorsToRemove.clear();
}
Program: 2883
Project: 2883
Buggy source:
public TransitionImpl(T mutableObject,TypeConverter<T> typeConverter){
  this.mutableObject=mutableObject;
  this.typeConverter=typeConverter;
  transition=new TransitionFloatArrayImpl(typeConverter.variables());
  typeConverter.copyFromObject(mutableObject,transition.get());
}

Fixed version (ground truth):
public TransitionImpl(T mutableObject,TypeConverter<T> typeConverter){
  this.mutableObject=mutableObject;
  this.typeConverter=typeConverter;
  transition=new TransitionFloatArrayImpl(typeConverter.variables());
  tmp=typeConverter.copyFromObject(mutableObject,tmp);
  transition.set(tmp);
}
Program: 2884
Project: 2884
Buggy source:
@Override public float[] copyFromObject(MyObject object,float[] x){
  x[0]=object.x;
  x[1]=object.y;
  x[2]=object.x + object.y;
  return x;
}

Fixed version (ground truth):
@Override public float[] copyFromObject(MyObject object,float[] x){
  if (x == null)   x=new float[variables()];
  x[0]=object.x;
  x[1]=object.y;
  x[2]=object.x + object.y;
  return x;
}
Program: 2885
Project: 2885
Buggy source:
@Test public void testBuilderWithCustomTypeConverter(){
  MyObject myObject=new MyObject();
  myObject.x=40f;
  myObject.y=40f;
  Transition<MyObject> transition=Transitions.transition(myObject,new MyObjectTypeConverter(){
    @Override public int variables(){
      return 3;
    }
    @Override public MyObject copyToObject(    MyObject object,    float[] x){
      object.x=2f * x[0] - 1f;
      object.y=-1f * x[1] - x[2] + 5f;
      return object;
    }
    @Override public float[] copyFromObject(    MyObject object,    float[] x){
      x[0]=object.x;
      x[1]=object.y;
      x[2]=object.x + object.y;
      return x;
    }
  }
).start(1f,2f,3f).end(1f,10f,20f,30f).build();
  assertThat(myObject.x,IsEqual.equalTo(1f));
  assertThat(myObject.y,IsEqual.equalTo(0f));
  transition.update(1f);
  assertThat(myObject.x,IsEqual.equalTo(19f));
  assertThat(myObject.y,IsEqual.equalTo(-45f));
}

Fixed version (ground truth):
@Test public void testBuilderWithCustomTypeConverter(){
  MyObject myObject=new MyObject();
  myObject.x=40f;
  myObject.y=40f;
  Transition<MyObject> transition=Transitions.transition(myObject,new MyObjectTypeConverter(){
    @Override public int variables(){
      return 3;
    }
    @Override public MyObject copyToObject(    MyObject object,    float[] x){
      object.x=2f * x[0] - 1f;
      object.y=-1f * x[1] - x[2] + 5f;
      return object;
    }
    @Override public float[] copyFromObject(    MyObject object,    float[] x){
      if (x == null)       x=new float[variables()];
      x[0]=object.x;
      x[1]=object.y;
      x[2]=object.x + object.y;
      return x;
    }
  }
).start(1f,2f,3f).end(1f,10f,20f,30f).build();
  assertThat(myObject.x,IsEqual.equalTo(1f));
  assertThat(myObject.y,IsEqual.equalTo(0f));
  transition.update(1f);
  assertThat(myObject.x,IsEqual.equalTo(19f));
  assertThat(myObject.y,IsEqual.equalTo(-45f));
}
Program: 2886
Project: 2886
Buggy source:
public static Builders.TimelineAnimationBuilder animation(Builders.TimelineBuilder timelineBuilder){
  return timelineAnimationBuilder.setTimeline(timelineBuilder.build());
}

Fixed version (ground truth):
public static Builders.TimelineAnimationBuilder animation(Builders.TimelineBuilder timelineBuilder){
  return timelineAnimationBuilder.setTimelineBuilder(timelineBuilder);
}
Program: 2887
Project: 2887
Buggy source:
public TimelineAnimation build(){
  TimelineAnimation timelineAnimation=new TimelineAnimation(timeline,started);
  timelineAnimation.setDelay(delay);
  timelineAnimation.setSpeed(speed);
  reset();
  return timelineAnimation;
}

Fixed version (ground truth):
public TimelineAnimation build(){
  float duration=timelineBuilder.getDuration();
  TimelineAnimation timelineAnimation=new TimelineAnimation(timelineBuilder.build(),started);
  timelineAnimation.setDuration(duration);
  timelineAnimation.setDelay(delay);
  timelineAnimation.setSpeed(speed);
  reset();
  return timelineAnimation;
}
Program: 2888
Project: 2888
Buggy source:
@Test public void testAnimationBuilder(){
  TimelineAnimation timelineAnimation=Builders.animation(Builders.timeline().value(Builders.timelineValue("String_Node_Str").typeConverter(Converters.floatValue()).keyFrame(0,500f).keyFrame(500,12500f).keyFrame(1000,500f)).value(Builders.timelineValue("String_Node_Str").keyFrame(0,3f).keyFrame(500,10f).keyFrame(1000,50f))).speed(2f).delay(200).started(true).build();
  assertThat(timelineAnimation.getDelay(),IsEqual.equalTo(200f));
  System.out.println(timelineAnimation.getTimeline());
}

Fixed version (ground truth):
@Test public void testAnimationBuilder(){
  TimelineAnimation timelineAnimation=Builders.animation(Builders.timeline().value(Builders.timelineValue("String_Node_Str").typeConverter(Converters.floatValue()).keyFrame(0,500f).keyFrame(500,12500f).keyFrame(1000,500f)).value(Builders.timelineValue("String_Node_Str").keyFrame(0,3f).keyFrame(500,10f).keyFrame(1000,50f))).speed(2f).delay(200).started(true).build();
  assertThat(timelineAnimation.getDelay(),IsEqual.equalTo(200f));
  assertThat(timelineAnimation.getDuration(),IsEqual.equalTo(1200f));
  System.out.println(timelineAnimation.getTimeline());
}
Program: 2889
Project: 2889
Buggy source:
/** 
 * Returns the percentage of the current time over the total time.
 * @return
 */
public float get(){
  return ((float)currentTime / (float)transitionTime);
}

Fixed version (ground truth):
/** 
 * Returns the percentage of the current time over the total time.
 * @return
 */
public float get(){
  if (transitionTime == 0)   return 1f;
  return ((float)currentTime / (float)transitionTime);
}
Program: 2890
Project: 2890
Buggy source:
@Override public void set(T t,int time){
  this.desiredValue=typeConverter.copyFromObject(t,desiredValue);
  this.totalTime=time;
  if (currentValue != null) {
    this.startValue=currentValue;
    this.currentValue=null;
  }
  this.currentTime=0;
  if (time == 0)   this.currentValue=interpolator.interpolate(startValue,desiredValue,1f);
}

Fixed version (ground truth):
@Override public void set(T t,int time){
  this.desiredValue=typeConverter.copyFromObject(t,desiredValue);
  this.totalTime=time;
  if (currentValue != null)   copyArray(startValue,currentValue);
  this.currentTime=0;
  if (time == 0)   this.currentValue=interpolator.interpolate(startValue,desiredValue,1f);
}
Program: 2891
Project: 2891
Buggy source:
public void stop(){
  currentTime=0;
  iteration=1;
  pause();
}

Fixed version (ground truth):
public void stop(){
  currentTime=0;
  iteration=1;
  playingDirection=PlayingDirection.Normal;
  pause();
}
Program: 2892
Project: 2892
Buggy source:
/** 
 * Updates the current value to the new value.
 * @param time - The time to update the current value.
 */
public void update(int time){
  if (currentTime == totalTime)   return;
  currentTime+=time;
  if (currentTime > totalTime)   currentTime=totalTime;
  float alpha=(float)currentTime / (float)totalTime;
  currentValue=interpolator.interpolate(startValue,desiredValue,alpha);
}

Fixed version (ground truth):
/** 
 * Updates the current value to the new value.
 * @param time - The time to update the current value.
 */
public void update(int time){
  if (currentTime == totalTime)   return;
  currentTime+=time;
  if (currentTime > totalTime)   currentTime=totalTime;
  if (desiredValue == null)   return;
  float alpha=(float)currentTime / (float)totalTime;
  currentValue=interpolator.interpolate(startValue,desiredValue,alpha);
}
Program: 2893
Project: 2893
Buggy source:
@Override public void set(T value){
  lastTime=timeProvider.getTime();
  interpolatedValue.setA(interpolatedValue.getInterpolatedValue());
  interpolatedValue.setB(value);
  interpolatedValue.setAlpha(0f);
}

Fixed version (ground truth):
@Override public void set(T value){
  lastTime=timeProvider.getTime();
  transition.set(value,1000);
}
Program: 2894
Project: 2894
Buggy source:
/** 
 * @param interpolatedValue
 * @param speed - The speed is specified in seconds and it is used to advance from one value to another value of the interpolated value.
 */
public InterpolatedProperty(InterpolatedValue<T> interpolatedValue,float speed){
  this(interpolatedValue,speed,new SystemTimeProvider());
}

Fixed version (ground truth):
/** 
 * @param transition - The transition to be used to set and get values for the property.
 * @param speed - The speed is specified in seconds and it is used to advance from one value to another value of the interpolated value.
 */
public InterpolatedProperty(Transition<T> transition,float speed){
  this(transition,speed,new SystemTimeProvider());
}
Program: 2895
Project: 2895
Buggy source:
@Override public T get(){
  long currentTime=timeProvider.getTime();
  float time=((float)(currentTime - lastTime)) * speed;
  interpolatedValue.setAlpha(time);
  return interpolatedValue.getInterpolatedValue();
}

Fixed version (ground truth):
@Override public T get(){
  long currentTime=timeProvider.getTime();
  float time=((float)(currentTime - lastTime)) * speed;
  transition.update((int)(time * 1000f));
  lastTime=currentTime;
  return transition.get();
}
Program: 2896
Project: 2896
Buggy source:
@Test public void shouldReturnInterpolatedValue(){
  UpdateableTimeProvider timeProvider=new UpdateableTimeProvider();
  InterpolatedProperty<Float> interpolatedProperty=new InterpolatedProperty<Float>(new FloatInterpolatedValue(100f),0.01f,timeProvider);
  assertThat(interpolatedProperty.get(),IsEqual.equalTo(100f));
  interpolatedProperty.set(200f);
  timeProvider.update(50);
  assertThat(interpolatedProperty.get(),IsEqual.equalTo(150f));
}

Fixed version (ground truth):
@Test public void shouldReturnInterpolatedValue(){
  InterpolatedProperty<Float> interpolatedProperty=new InterpolatedProperty<Float>(new Transition<Float>(100f,interpolator),0.01f,timeProvider);
  assertThat(interpolatedProperty.get(),IsEqual.equalTo(100f));
  interpolatedProperty.set(200f);
  timeProvider.update(50);
  assertThat(interpolatedProperty.get(),IsEqual.equalTo(150f));
  timeProvider.update(25);
  assertThat(interpolatedProperty.get(),IsEqual.equalTo(175f));
}
Program: 2897
Project: 2897
Buggy source:
@Test public void shouldReturnFirstValueWhenNoTimePassed(){
  UpdateableTimeProvider timeProvider=new UpdateableTimeProvider();
  InterpolatedProperty<Float> interpolatedProperty=new InterpolatedProperty<Float>(new FloatInterpolatedValue(100f),1f,timeProvider);
  assertThat(interpolatedProperty.get(),IsEqual.equalTo(100f));
  interpolatedProperty.set(200f);
  assertThat(interpolatedProperty.get(),IsEqual.equalTo(100f));
}

Fixed version (ground truth):
@Test public void shouldReturnFirstValueWhenNoTimePassed(){
  InterpolatedProperty<Float> interpolatedProperty=new InterpolatedProperty<Float>(new Transition<Float>(100f,interpolator),1f,timeProvider);
  assertThat(interpolatedProperty.get(),IsEqual.equalTo(100f));
  interpolatedProperty.set(200f);
  assertThat(interpolatedProperty.get(),IsEqual.equalTo(100f));
}
Program: 2898
Project: 2898
Buggy source:
@Test public void shouldReturnSecondValueWhenTimePassed(){
  UpdateableTimeProvider timeProvider=new UpdateableTimeProvider();
  InterpolatedProperty<Float> interpolatedProperty=new InterpolatedProperty<Float>(new FloatInterpolatedValue(100f),1f,timeProvider);
  assertThat(interpolatedProperty.get(),IsEqual.equalTo(100f));
  interpolatedProperty.set(200f);
  timeProvider.update(10000);
  assertThat(interpolatedProperty.get(),IsEqual.equalTo(200f));
}

Fixed version (ground truth):
@Test public void shouldReturnSecondValueWhenTimePassed(){
  InterpolatedProperty<Float> interpolatedProperty=new InterpolatedProperty<Float>(new Transition<Float>(100f,interpolator),1f,timeProvider);
  assertThat(interpolatedProperty.get(),IsEqual.equalTo(100f));
  interpolatedProperty.set(200f);
  timeProvider.update(10000);
  assertThat(interpolatedProperty.get(),IsEqual.equalTo(200f));
}
Program: 2899
Project: 2899
Buggy source:
/** 
 * Convenience method to retrieve a HTTP request,response or  an ICAP options response body from an aggregated IcapMessage. 
 * @param message
 * @return null or @see {@link ChannelBuffer} if a body exists.
 */
public static ChannelBuffer extractHttpBodyContentFromIcapMessage(IcapMessage message){
  ChannelBuffer buffer=null;
  if (message.getBodyType().equals(IcapMessageElementEnum.REQBODY) && message.getHttpRequest() != null) {
    buffer=message.getHttpRequest().getContent();
  }
 else   if (message.getBodyType().equals(IcapMessageElementEnum.RESBODY) && message.getHttpResponse() != null) {
    buffer=message.getHttpResponse().getContent();
  }
 else   if (message instanceof IcapResponse && message.getBodyType().equals(IcapMessageElementEnum.OPTBODY)) {
    IcapResponse response=(IcapResponse)message;
    buffer=response.getContent();
  }
  return buffer;
}

Fixed version (ground truth):
/** 
 * Convenience method to retrieve a HTTP request,response or  an ICAP options response body from an aggregated IcapMessage. 
 * @param message
 * @return null or @see {@link ChannelBuffer} if a body exists.
 */
public static ChannelBuffer extractHttpBodyContentFromIcapMessage(IcapMessage message){
  ChannelBuffer buffer=null;
  if (message != null) {
    if (message.getHttpRequest() != null && message.getHttpRequest().getContent().readableBytes() > 0) {
      buffer=message.getHttpRequest().getContent();
    }
 else     if (message.getHttpResponse() != null && message.getHttpResponse().getContent().readableBytes() > 0) {
      buffer=message.getHttpResponse().getContent();
    }
 else     if (message instanceof IcapResponse) {
      if (((IcapResponse)message).getContent().readableBytes() > 0) {
        buffer=((IcapResponse)message).getContent();
      }
    }
  }
  return buffer;
}
Program: 2900
Project: 2900
Buggy source:
private void validateMandatoryMessageHeaders(IcapMessage message,boolean isDecodingResponse){
  if (!isDecodingResponse) {
    if (!message.containsHeader(IcapHeaders.Names.HOST)) {
      throw new IcapDecodingError("String_Node_Str");
    }
  }
  if (!message.containsHeader(IcapHeaders.Names.ENCAPSULATED)) {
    throw new IcapDecodingError("String_Node_Str");
  }
}

Fixed version (ground truth):
private void validateMandatoryMessageHeaders(IcapMessage message,boolean isDecodingResponse,boolean isDecodingOptionsRequest){
  if (!isDecodingResponse) {
    if (!message.containsHeader(IcapHeaders.Names.HOST)) {
      throw new IcapDecodingError("String_Node_Str");
    }
  }
  if (!isDecodingOptionsRequest) {
    if (!message.containsHeader(IcapHeaders.Names.ENCAPSULATED)) {
      throw new IcapDecodingError("String_Node_Str");
    }
  }
}