nus-yam/ex-repair huggingface dataset:
Program: 41998
Project: 41998
Buggy source:
private void installNewPackageLI(PackageParser.Package pkg,int parseFlags,int scanMode,String installerPackageName,PackageInstalledInfo res){
  String pkgName=pkg.packageName;
  boolean dataDirExists=getDataPathForPackage(pkg).exists();
  res.name=pkgName;
synchronized (mPackages) {
    if (mPackages.containsKey(pkgName) || mAppDirs.containsKey(pkg.mPath)) {
      Slog.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      res.returnCode=PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
      return;
    }
  }
  mLastScanError=PackageManager.INSTALL_SUCCEEDED;
  PackageParser.Package newPackage=scanPackageLI(pkg,parseFlags,scanMode);
  if (newPackage == null) {
    Slog.w(TAG,"String_Node_Str" + pkg.mPath);
    if ((res.returnCode=mLastScanError) == PackageManager.INSTALL_SUCCEEDED) {
      res.returnCode=PackageManager.INSTALL_FAILED_INVALID_APK;
    }
  }
 else {
    updateSettingsLI(newPackage,installerPackageName,res);
    if (res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
      deletePackageLI(pkgName,false,dataDirExists ? PackageManager.DONT_DELETE_DATA : 0,res.removedInfo);
    }
  }
}

Fixed version (ground truth):
private void installNewPackageLI(PackageParser.Package pkg,int parseFlags,int scanMode,String installerPackageName,PackageInstalledInfo res){
  String pkgName=pkg.packageName;
  boolean dataDirExists=getDataPathForPackage(pkg).exists();
  res.name=pkgName;
synchronized (mPackages) {
    if (mSettings.mRenamedPackages.containsKey(pkgName)) {
      Slog.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ mSettings.mRenamedPackages.get(pkgName));
      res.returnCode=PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
      return;
    }
    if (mPackages.containsKey(pkgName) || mAppDirs.containsKey(pkg.mPath)) {
      Slog.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      res.returnCode=PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
      return;
    }
  }
  mLastScanError=PackageManager.INSTALL_SUCCEEDED;
  PackageParser.Package newPackage=scanPackageLI(pkg,parseFlags,scanMode);
  if (newPackage == null) {
    Slog.w(TAG,"String_Node_Str" + pkg.mPath);
    if ((res.returnCode=mLastScanError) == PackageManager.INSTALL_SUCCEEDED) {
      res.returnCode=PackageManager.INSTALL_FAILED_INVALID_APK;
    }
  }
 else {
    updateSettingsLI(newPackage,installerPackageName,res);
    if (res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
      deletePackageLI(pkgName,false,dataDirExists ? PackageManager.DONT_DELETE_DATA : 0,res.removedInfo);
    }
  }
}
Program: 42000
Project: 42000
Buggy source:
private void installNewPackageLI(PackageParser.Package pkg,int parseFlags,int scanMode,String installerPackageName,PackageInstalledInfo res){
  String pkgName=pkg.packageName;
  boolean dataDirExists=getDataPathForPackage(pkg).exists();
  res.name=pkgName;
synchronized (mPackages) {
    if (mPackages.containsKey(pkgName) || mAppDirs.containsKey(pkg.mPath)) {
      Slog.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      res.returnCode=PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
      return;
    }
  }
  mLastScanError=PackageManager.INSTALL_SUCCEEDED;
  PackageParser.Package newPackage=scanPackageLI(pkg,parseFlags,scanMode);
  if (newPackage == null) {
    Slog.w(TAG,"String_Node_Str" + pkg.mPath);
    if ((res.returnCode=mLastScanError) == PackageManager.INSTALL_SUCCEEDED) {
      res.returnCode=PackageManager.INSTALL_FAILED_INVALID_APK;
    }
  }
 else {
    updateSettingsLI(newPackage,installerPackageName,res);
    if (res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
      deletePackageLI(pkgName,false,dataDirExists ? PackageManager.DONT_DELETE_DATA : 0,res.removedInfo);
    }
  }
}

Fixed version (ground truth):
private void installNewPackageLI(PackageParser.Package pkg,int parseFlags,int scanMode,String installerPackageName,PackageInstalledInfo res){
  String pkgName=pkg.packageName;
  boolean dataDirExists=getDataPathForPackage(pkg).exists();
  res.name=pkgName;
synchronized (mPackages) {
    if (mSettings.mRenamedPackages.containsKey(pkgName)) {
      Slog.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ mSettings.mRenamedPackages.get(pkgName));
      res.returnCode=PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
      return;
    }
    if (mPackages.containsKey(pkgName) || mAppDirs.containsKey(pkg.mPath)) {
      Slog.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      res.returnCode=PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
      return;
    }
  }
  mLastScanError=PackageManager.INSTALL_SUCCEEDED;
  PackageParser.Package newPackage=scanPackageLI(pkg,parseFlags,scanMode);
  if (newPackage == null) {
    Slog.w(TAG,"String_Node_Str" + pkg.mPath);
    if ((res.returnCode=mLastScanError) == PackageManager.INSTALL_SUCCEEDED) {
      res.returnCode=PackageManager.INSTALL_FAILED_INVALID_APK;
    }
  }
 else {
    updateSettingsLI(newPackage,installerPackageName,res);
    if (res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
      deletePackageLI(pkgName,false,dataDirExists ? PackageManager.DONT_DELETE_DATA : 0,res.removedInfo);
    }
  }
}
Program: 42014
Project: 42014
Buggy source:
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}
Program: 42015
Project: 42015
Buggy source:
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label;
    }
  }
  return ci.loadLabel(pm);
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label.toString().trim();
    }
  }
  CharSequence data=ci.loadLabel(pm);
  if (data != null)   data=data.toString().trim();
  return data;
}
Program: 42016
Project: 42016
Buggy source:
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}
Program: 42017
Project: 42017
Buggy source:
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label;
    }
  }
  return ci.loadLabel(pm);
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label.toString().trim();
    }
  }
  CharSequence data=ci.loadLabel(pm);
  if (data != null)   data=data.toString().trim();
  return data;
}
Program: 42018
Project: 42018
Buggy source:
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}
Program: 42019
Project: 42019
Buggy source:
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label;
    }
  }
  return ci.loadLabel(pm);
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label.toString().trim();
    }
  }
  CharSequence data=ci.loadLabel(pm);
  if (data != null)   data=data.toString().trim();
  return data;
}
Program: 42020
Project: 42020
Buggy source:
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}
Program: 42021
Project: 42021
Buggy source:
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label;
    }
  }
  return ci.loadLabel(pm);
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label.toString().trim();
    }
  }
  CharSequence data=ci.loadLabel(pm);
  if (data != null)   data=data.toString().trim();
  return data;
}
Program: 42022
Project: 42022
Buggy source:
private static void showUsage(){
  System.err.println("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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
private static void showUsage(){
  System.err.println("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"+ "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");
}
Program: 42025
Project: 42025
Buggy source:
private static void showUsage(){
  System.err.println("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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
private static void showUsage(){
  System.err.println("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"+ "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");
}
Program: 42028
Project: 42028
Buggy source:
private static void showUsage(){
  System.err.println("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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
private static void showUsage(){
  System.err.println("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"+ "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");
}
Program: 42031
Project: 42031
Buggy source:
void startSpringback(){
  if (mScroller.springback(0,mScrollY,0,0,0,0)) {
    mTouchMode=TOUCH_MODE_OVERFLING;
    invalidate();
    post(this);
  }
}

Fixed version (ground truth):
void startSpringback(){
  if (mScroller.springback(0,mScrollY,0,0,0,0)) {
    mTouchMode=TOUCH_MODE_OVERFLING;
    invalidate();
    post(this);
  }
 else {
    mTouchMode=TOUCH_MODE_REST;
  }
}
Program: 42032
Project: 42032
Buggy source:
void startSpringback(){
  if (mScroller.springback(0,mScrollY,0,0,0,0)) {
    mTouchMode=TOUCH_MODE_OVERFLING;
    invalidate();
    post(this);
  }
}

Fixed version (ground truth):
void startSpringback(){
  if (mScroller.springback(0,mScrollY,0,0,0,0)) {
    mTouchMode=TOUCH_MODE_OVERFLING;
    invalidate();
    post(this);
  }
 else {
    mTouchMode=TOUCH_MODE_REST;
  }
}
Program: 42034
Project: 42034
Buggy source:
/** 
 * Have the surface flinger show a surface, robustly dealing with error conditions.  In particular, if there is not enough memory to show the surface, then we will try to get rid of other surfaces in order to succeed.
 * @return Returns true if the surface was successfully shown.
 */
boolean showSurfaceRobustlyLocked(WindowState win){
  try {
    if (win.mSurface != null) {
      win.mSurface.show();
      if (win.mTurnOnScreen) {
        if (DEBUG_VISIBILITY)         Slog.v(TAG,"String_Node_Str" + win);
        win.mTurnOnScreen=false;
        mTurnOnScreen=true;
      }
    }
    return true;
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + win.mSurface + "String_Node_Str"+ win);
  }
  reclaimSomeSurfaceMemoryLocked(win,"String_Node_Str");
  return false;
}

Fixed version (ground truth):
/** 
 * Have the surface flinger show a surface, robustly dealing with error conditions.  In particular, if there is not enough memory to show the surface, then we will try to get rid of other surfaces in order to succeed.
 * @return Returns true if the surface was successfully shown.
 */
boolean showSurfaceRobustlyLocked(WindowState win){
  try {
    if (win.mSurface != null) {
      win.mSurfaceShown=true;
      win.mSurface.show();
      if (win.mTurnOnScreen) {
        if (DEBUG_VISIBILITY)         Slog.v(TAG,"String_Node_Str" + win);
        win.mTurnOnScreen=false;
        mTurnOnScreen=true;
      }
    }
    return true;
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + win.mSurface + "String_Node_Str"+ win);
  }
  reclaimSomeSurfaceMemoryLocked(win,"String_Node_Str");
  return false;
}
Program: 42036
Project: 42036
Buggy source:
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (SHOW_TRANSACTIONS)   Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
  mDimShown=true;
  try {
    mDimSurface.setPosition(0,0);
    mDimSurface.setSize(dw,dh);
    mDimSurface.show();
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (!mDimShown) {
    if (SHOW_TRANSACTIONS)     Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
    mDimShown=true;
    try {
      mDimSurface.setPosition(0,0);
      mDimSurface.setSize(dw,dh);
      mDimSurface.show();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
}
Program: 42037
Project: 42037
Buggy source:
void finishExit(){
  if (DEBUG_ANIM)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mExiting+ "String_Node_Str"+ mRemoveOnExit+ "String_Node_Str"+ isWindowAnimating());
  final int N=mChildWindows.size();
  for (int i=0; i < N; i++) {
    ((WindowState)mChildWindows.get(i)).finishExit();
  }
  if (!mExiting) {
    return;
  }
  if (isWindowAnimating()) {
    return;
  }
  if (localLOGV)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mRemoveOnExit);
  if (mSurface != null) {
    mDestroySurface.add(this);
    mDestroying=true;
    if (SHOW_TRANSACTIONS)     logSurface(this,"String_Node_Str",null);
    try {
      mSurface.hide();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str" + this,e);
    }
    mLastHidden=true;
    mKeyWaiter.releasePendingPointerLocked(mSession);
  }
  mExiting=false;
  if (mRemoveOnExit) {
    mPendingRemove.add(this);
    mRemoveOnExit=false;
  }
}

Fixed version (ground truth):
void finishExit(){
  if (DEBUG_ANIM)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mExiting+ "String_Node_Str"+ mRemoveOnExit+ "String_Node_Str"+ isWindowAnimating());
  final int N=mChildWindows.size();
  for (int i=0; i < N; i++) {
    ((WindowState)mChildWindows.get(i)).finishExit();
  }
  if (!mExiting) {
    return;
  }
  if (isWindowAnimating()) {
    return;
  }
  if (localLOGV)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mRemoveOnExit);
  if (mSurface != null) {
    mDestroySurface.add(this);
    mDestroying=true;
    if (SHOW_TRANSACTIONS)     logSurface(this,"String_Node_Str",null);
    mSurfaceShown=false;
    try {
      mSurface.hide();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str" + this,e);
    }
    mLastHidden=true;
    mKeyWaiter.releasePendingPointerLocked(mSession);
  }
  mExiting=false;
  if (mRemoveOnExit) {
    mPendingRemove.add(this);
    mRemoveOnExit=false;
  }
}
Program: 42041
Project: 42041
Buggy source:
/** 
 * Have the surface flinger show a surface, robustly dealing with error conditions.  In particular, if there is not enough memory to show the surface, then we will try to get rid of other surfaces in order to succeed.
 * @return Returns true if the surface was successfully shown.
 */
boolean showSurfaceRobustlyLocked(WindowState win){
  try {
    if (win.mSurface != null) {
      win.mSurface.show();
      if (win.mTurnOnScreen) {
        if (DEBUG_VISIBILITY)         Slog.v(TAG,"String_Node_Str" + win);
        win.mTurnOnScreen=false;
        mTurnOnScreen=true;
      }
    }
    return true;
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + win.mSurface + "String_Node_Str"+ win);
  }
  reclaimSomeSurfaceMemoryLocked(win,"String_Node_Str");
  return false;
}

Fixed version (ground truth):
/** 
 * Have the surface flinger show a surface, robustly dealing with error conditions.  In particular, if there is not enough memory to show the surface, then we will try to get rid of other surfaces in order to succeed.
 * @return Returns true if the surface was successfully shown.
 */
boolean showSurfaceRobustlyLocked(WindowState win){
  try {
    if (win.mSurface != null) {
      win.mSurfaceShown=true;
      win.mSurface.show();
      if (win.mTurnOnScreen) {
        if (DEBUG_VISIBILITY)         Slog.v(TAG,"String_Node_Str" + win);
        win.mTurnOnScreen=false;
        mTurnOnScreen=true;
      }
    }
    return true;
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + win.mSurface + "String_Node_Str"+ win);
  }
  reclaimSomeSurfaceMemoryLocked(win,"String_Node_Str");
  return false;
}
Program: 42043
Project: 42043
Buggy source:
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (SHOW_TRANSACTIONS)   Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
  mDimShown=true;
  try {
    mDimSurface.setPosition(0,0);
    mDimSurface.setSize(dw,dh);
    mDimSurface.show();
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (!mDimShown) {
    if (SHOW_TRANSACTIONS)     Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
    mDimShown=true;
    try {
      mDimSurface.setPosition(0,0);
      mDimSurface.setSize(dw,dh);
      mDimSurface.show();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
}
Program: 42044
Project: 42044
Buggy source:
void finishExit(){
  if (DEBUG_ANIM)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mExiting+ "String_Node_Str"+ mRemoveOnExit+ "String_Node_Str"+ isWindowAnimating());
  final int N=mChildWindows.size();
  for (int i=0; i < N; i++) {
    ((WindowState)mChildWindows.get(i)).finishExit();
  }
  if (!mExiting) {
    return;
  }
  if (isWindowAnimating()) {
    return;
  }
  if (localLOGV)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mRemoveOnExit);
  if (mSurface != null) {
    mDestroySurface.add(this);
    mDestroying=true;
    if (SHOW_TRANSACTIONS)     logSurface(this,"String_Node_Str",null);
    try {
      mSurface.hide();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str" + this,e);
    }
    mLastHidden=true;
    mKeyWaiter.releasePendingPointerLocked(mSession);
  }
  mExiting=false;
  if (mRemoveOnExit) {
    mPendingRemove.add(this);
    mRemoveOnExit=false;
  }
}

Fixed version (ground truth):
void finishExit(){
  if (DEBUG_ANIM)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mExiting+ "String_Node_Str"+ mRemoveOnExit+ "String_Node_Str"+ isWindowAnimating());
  final int N=mChildWindows.size();
  for (int i=0; i < N; i++) {
    ((WindowState)mChildWindows.get(i)).finishExit();
  }
  if (!mExiting) {
    return;
  }
  if (isWindowAnimating()) {
    return;
  }
  if (localLOGV)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mRemoveOnExit);
  if (mSurface != null) {
    mDestroySurface.add(this);
    mDestroying=true;
    if (SHOW_TRANSACTIONS)     logSurface(this,"String_Node_Str",null);
    mSurfaceShown=false;
    try {
      mSurface.hide();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str" + this,e);
    }
    mLastHidden=true;
    mKeyWaiter.releasePendingPointerLocked(mSession);
  }
  mExiting=false;
  if (mRemoveOnExit) {
    mPendingRemove.add(this);
    mRemoveOnExit=false;
  }
}
Program: 42048
Project: 42048
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float x=ev.getX(pointerIndex);
      final int xDiff=(int)Math.abs(x - mLastMotionX);
      if (xDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionX=x;
        if (mParent != null)         mParent.requestDisallowInterceptTouchEvent(true);
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float x=ev.getX();
    if (!inChild((int)x,(int)ev.getY())) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionX=x;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float x=ev.getX(pointerIndex);
      final int xDiff=(int)Math.abs(x - mLastMotionX);
      if (xDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionX=x;
        if (mParent != null)         mParent.requestDisallowInterceptTouchEvent(true);
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float x=ev.getX();
    if (!inChild((int)x,(int)ev.getY())) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionX=x;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
if (mScroller.springback(mScrollX,mScrollY,0,getScrollRange(),0,0)) {
invalidate();
}
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}
Program: 42049
Project: 42049
Buggy source:
private boolean inChild(int x,int y){
  if (getChildCount() > 0) {
    final View child=getChildAt(0);
    return !(y < child.getTop() || y >= child.getBottom() || x < child.getLeft() || x >= child.getRight());
  }
  return false;
}

Fixed version (ground truth):
private boolean inChild(int x,int y){
  if (getChildCount() > 0) {
    final int scrollX=mScrollX;
    final View child=getChildAt(0);
    return !(y < child.getTop() || y >= child.getBottom() || x < child.getLeft() - scrollX || x >= child.getRight() - scrollX);
  }
  return false;
}
Program: 42051
Project: 42051
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float y=ev.getY(pointerIndex);
      final int yDiff=(int)Math.abs(y - mLastMotionY);
      if (yDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionY=y;
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float y=ev.getY();
    if (!inChild((int)ev.getX(),(int)y)) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionY=y;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float y=ev.getY(pointerIndex);
      final int yDiff=(int)Math.abs(y - mLastMotionY);
      if (yDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionY=y;
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float y=ev.getY();
    if (!inChild((int)ev.getX(),(int)y)) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionY=y;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
if (mScroller.springback(mScrollX,mScrollY,0,0,0,getScrollRange())) {
invalidate();
}
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}
Program: 42052
Project: 42052
Buggy source:
private boolean inChild(int x,int y){
  if (getChildCount() > 0) {
    final View child=getChildAt(0);
    return !(y < child.getTop() || y >= child.getBottom() || x < child.getLeft() || x >= child.getRight());
  }
  return false;
}

Fixed version (ground truth):
private boolean inChild(int x,int y){
  if (getChildCount() > 0) {
    final int scrollY=mScrollY;
    final View child=getChildAt(0);
    return !(y < child.getTop() - scrollY || y >= child.getBottom() - scrollY || x < child.getLeft() || x >= child.getRight());
  }
  return false;
}
Program: 42053
Project: 42053
Buggy source:
private boolean chooseNewDefaultIMELocked(){
  List<InputMethodInfo> enabled=getEnabledInputMethodListLocked();
  if (enabled != null && enabled.size() > 0) {
    Settings.Secure.putString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD,enabled.get(0).getId());
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean chooseNewDefaultIMELocked(){
  List<InputMethodInfo> enabled=getEnabledInputMethodListLocked();
  if (enabled != null && enabled.size() > 0) {
    int i=enabled.size();
    while (i > 0) {
      i--;
      if ((enabled.get(i).getServiceInfo().applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
        break;
      }
    }
    Settings.Secure.putString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD,enabled.get(i).getId());
    return true;
  }
  return false;
}
Program: 42054
Project: 42054
Buggy source:
void buildInputMethodListLocked(ArrayList<InputMethodInfo> list,HashMap<String,InputMethodInfo> map){
  list.clear();
  map.clear();
  PackageManager pm=mContext.getPackageManager();
  List<ResolveInfo> services=pm.queryIntentServices(new Intent(InputMethod.SERVICE_INTERFACE),PackageManager.GET_META_DATA);
  for (int i=0; i < services.size(); ++i) {
    ResolveInfo ri=services.get(i);
    ServiceInfo si=ri.serviceInfo;
    ComponentName compName=new ComponentName(si.packageName,si.name);
    if (!android.Manifest.permission.BIND_INPUT_METHOD.equals(si.permission)) {
      Slog.w(TAG,"String_Node_Str" + compName + "String_Node_Str"+ android.Manifest.permission.BIND_INPUT_METHOD);
      continue;
    }
    if (DEBUG)     Slog.d(TAG,"String_Node_Str" + compName);
    try {
      InputMethodInfo p=new InputMethodInfo(mContext,ri);
      list.add(p);
      map.put(p.getId(),p);
      if (isSystemIme(p)) {
        setInputMethodEnabled(p.getId(),true);
      }
      if (DEBUG) {
        Slog.d(TAG,"String_Node_Str" + p);
      }
    }
 catch (    XmlPullParserException e) {
      Slog.w(TAG,"String_Node_Str" + compName,e);
    }
catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + compName,e);
    }
  }
  String defaultIme=Settings.Secure.getString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD);
  if (!map.containsKey(defaultIme)) {
    if (chooseNewDefaultIMELocked()) {
      updateFromSettingsLocked();
    }
  }
}

Fixed version (ground truth):
void buildInputMethodListLocked(ArrayList<InputMethodInfo> list,HashMap<String,InputMethodInfo> map){
  list.clear();
  map.clear();
  PackageManager pm=mContext.getPackageManager();
  List<ResolveInfo> services=pm.queryIntentServices(new Intent(InputMethod.SERVICE_INTERFACE),PackageManager.GET_META_DATA);
  for (int i=0; i < services.size(); ++i) {
    ResolveInfo ri=services.get(i);
    ServiceInfo si=ri.serviceInfo;
    ComponentName compName=new ComponentName(si.packageName,si.name);
    if (!android.Manifest.permission.BIND_INPUT_METHOD.equals(si.permission)) {
      Slog.w(TAG,"String_Node_Str" + compName + "String_Node_Str"+ android.Manifest.permission.BIND_INPUT_METHOD);
      continue;
    }
    if (DEBUG)     Slog.d(TAG,"String_Node_Str" + compName);
    try {
      InputMethodInfo p=new InputMethodInfo(mContext,ri);
      list.add(p);
      map.put(p.getId(),p);
      if (isSystemIme(p)) {
        setInputMethodEnabledLocked(p.getId(),true);
      }
      if (DEBUG) {
        Slog.d(TAG,"String_Node_Str" + p);
      }
    }
 catch (    XmlPullParserException e) {
      Slog.w(TAG,"String_Node_Str" + compName,e);
    }
catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + compName,e);
    }
  }
  String defaultIme=Settings.Secure.getString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD);
  if (!map.containsKey(defaultIme)) {
    if (chooseNewDefaultIMELocked()) {
      updateFromSettingsLocked();
    }
  }
}
Program: 42056
Project: 42056
Buggy source:
private void installDecor(){
  if (mDecor == null) {
    mDecor=generateDecor();
    mDecor.setIsRootNamespace(true);
  }
  if (mContentParent == null) {
    mContentParent=generateLayout(mDecor);
    mTitleView=(TextView)findViewById(com.android.internal.R.id.title);
    if (mTitleView != null) {
      if ((getLocalFeatures() & (1 << FEATURE_NO_TITLE)) != 0) {
        View titleContainer=findViewById(com.android.internal.R.id.title_container);
        if (titleContainer != null) {
          titleContainer.setVisibility(View.GONE);
        }
 else {
          mTitleView.setVisibility(View.GONE);
        }
        if (mContentParent instanceof FrameLayout) {
          ((FrameLayout)mContentParent).setForeground(null);
        }
      }
 else {
        mTitleView.setText(mTitle);
      }
    }
  }
}

Fixed version (ground truth):
private void installDecor(){
  if (mDecor == null) {
    mDecor=generateDecor();
    mDecor.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
    mDecor.setIsRootNamespace(true);
  }
  if (mContentParent == null) {
    mContentParent=generateLayout(mDecor);
    mTitleView=(TextView)findViewById(com.android.internal.R.id.title);
    if (mTitleView != null) {
      if ((getLocalFeatures() & (1 << FEATURE_NO_TITLE)) != 0) {
        View titleContainer=findViewById(com.android.internal.R.id.title_container);
        if (titleContainer != null) {
          titleContainer.setVisibility(View.GONE);
        }
 else {
          mTitleView.setVisibility(View.GONE);
        }
        if (mContentParent instanceof FrameLayout) {
          ((FrameLayout)mContentParent).setForeground(null);
        }
      }
 else {
        mTitleView.setText(mTitle);
      }
    }
  }
}
Program: 42057
Project: 42057
Buggy source:
private boolean chooseNewDefaultIMELocked(){
  List<InputMethodInfo> enabled=getEnabledInputMethodListLocked();
  if (enabled != null && enabled.size() > 0) {
    Settings.Secure.putString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD,enabled.get(0).getId());
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean chooseNewDefaultIMELocked(){
  List<InputMethodInfo> enabled=getEnabledInputMethodListLocked();
  if (enabled != null && enabled.size() > 0) {
    int i=enabled.size();
    while (i > 0) {
      i--;
      if ((enabled.get(i).getServiceInfo().applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
        break;
      }
    }
    Settings.Secure.putString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD,enabled.get(i).getId());
    return true;
  }
  return false;
}