Program: 43644
Project: 43644
Buggy source:
private PackageSetting getPackageLP(String name,SharedUserSetting sharedUser,File codePath,File resourcePath,int vc,int pkgFlags,boolean create,boolean add){
  PackageSetting p=mPackages.get(name);
  if (p != null) {
    if (!p.codePath.equals(codePath)) {
      PackageSetting ps=mDisabledSysPackages.get(name);
      if ((ps != null) && ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0)) {
        return p;
      }
 else       if ((p.pkg != null) && (p.pkg.applicationInfo != null) && ((p.pkg.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0)) {
        reportSettingsProblem(Log.WARN,"String_Node_Str" + name + "String_Node_Str"+ p.codePath+ "String_Node_Str"+ codePath+ "String_Node_Str");
      }
 else {
        reportSettingsProblem(Log.WARN,"String_Node_Str" + name + "String_Node_Str"+ p.codePath+ "String_Node_Str"+ codePath+ "String_Node_Str");
        p=null;
      }
    }
 else     if (p.sharedUser != sharedUser) {
      reportSettingsProblem(Log.WARN,"String_Node_Str" + name + "String_Node_Str"+ (p.sharedUser != null ? p.sharedUser.name : "String_Node_Str")+ "String_Node_Str"+ (sharedUser != null ? sharedUser.name : "String_Node_Str")+ "String_Node_Str");
      p=null;
    }
  }
  if (p == null) {
    if (!create) {
      return null;
    }
    p=new PackageSetting(name,codePath,resourcePath,vc,pkgFlags);
    p.setTimeStamp(codePath.lastModified());
    if (sharedUser != null) {
      p.userId=sharedUser.userId;
    }
 else     if (MULTIPLE_APPLICATION_UIDS) {
      p.userId=newUserIdLP(p);
    }
 else {
      p.userId=FIRST_APPLICATION_UID;
    }
    if (p.userId < 0) {
      reportSettingsProblem(Log.WARN,"String_Node_Str" + name + "String_Node_Str");
      return null;
    }
    if (add) {
      insertPackageSettingLP(p,name,sharedUser);
    }
  }
  return p;
}

Fixed version (ground truth):
private PackageSetting getPackageLP(String name,SharedUserSetting sharedUser,File codePath,File resourcePath,int vc,int pkgFlags,boolean create,boolean add){
  PackageSetting p=mPackages.get(name);
  if (p != null) {
    if (!p.codePath.equals(codePath)) {
      PackageSetting ps=mDisabledSysPackages.get(name);
      if ((ps != null) && ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0)) {
        return p;
      }
 else       if ((p.pkg != null) && (p.pkg.applicationInfo != null) && ((p.pkg.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0)) {
        reportSettingsProblem(Log.WARN,"String_Node_Str" + name + "String_Node_Str"+ p.codePath+ "String_Node_Str"+ codePath+ "String_Node_Str");
      }
 else {
        reportSettingsProblem(Log.WARN,"String_Node_Str" + name + "String_Node_Str"+ p.codePath+ "String_Node_Str"+ codePath+ "String_Node_Str");
        p=null;
      }
    }
 else     if (p.sharedUser != sharedUser) {
      reportSettingsProblem(Log.WARN,"String_Node_Str" + name + "String_Node_Str"+ (p.sharedUser != null ? p.sharedUser.name : "String_Node_Str")+ "String_Node_Str"+ (sharedUser != null ? sharedUser.name : "String_Node_Str")+ "String_Node_Str");
      p=null;
    }
  }
  if (p == null) {
    if (!create) {
      return null;
    }
    p=new PackageSetting(name,codePath,resourcePath,vc,pkgFlags);
    p.setTimeStamp(codePath.lastModified());
    p.sharedUser=sharedUser;
    if (sharedUser != null) {
      p.userId=sharedUser.userId;
    }
 else     if (MULTIPLE_APPLICATION_UIDS) {
      p.userId=newUserIdLP(p);
    }
 else {
      p.userId=FIRST_APPLICATION_UID;
    }
    if (p.userId < 0) {
      reportSettingsProblem(Log.WARN,"String_Node_Str" + name + "String_Node_Str");
      return null;
    }
    if (add) {
      insertPackageSettingLP(p,name,sharedUser);
    }
  }
  return p;
}