Program: 42439
Project: 42439
Buggy source:
private PackageSetting getPackageLP(String name,PackageSetting origPackage,String realName,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)) {
      if ((p != null) && ((p.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0)) {
        Log.w(TAG,"String_Node_Str" + p.codePathString + "String_Node_Str"+ codePath.toString());
      }
 else {
        reportSettingsProblem(Log.WARN,"String_Node_Str" + name + "String_Node_Str"+ p.codePath+ "String_Node_Str"+ codePath+ "String_Node_Str");
      }
    }
    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;
    }
 else {
      if ((pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0) {
        p.pkgFlags|=ApplicationInfo.FLAG_SYSTEM;
      }
    }
  }
  if (p == null) {
    if (!create) {
      return null;
    }
    if (origPackage != null) {
      p=new PackageSetting(origPackage.name,name,codePath,resourcePath,vc,pkgFlags);
      if (DEBUG_UPGRADE)       Log.v(TAG,"String_Node_Str" + name + "String_Node_Str"+ origPackage.name);
      p.copyFrom(origPackage);
      p.sharedUser=origPackage.sharedUser;
      p.userId=origPackage.userId;
      p.origPackage=origPackage;
      mRenamedPackages.put(name,origPackage.name);
      name=origPackage.name;
      p.setTimeStamp(codePath.lastModified());
    }
 else {
      p=new PackageSetting(name,realName,codePath,resourcePath,vc,pkgFlags);
      p.setTimeStamp(codePath.lastModified());
      p.sharedUser=sharedUser;
      if (sharedUser != null) {
        p.userId=sharedUser.userId;
      }
 else       if (MULTIPLE_APPLICATION_UIDS) {
        PackageSetting dis=mDisabledSysPackages.get(name);
        if (dis != null) {
          if (dis.signatures.mSignatures != null) {
            p.signatures.mSignatures=dis.signatures.mSignatures.clone();
          }
          p.userId=dis.userId;
          p.grantedPermissions=new HashSet<String>(dis.grantedPermissions);
          p.loadedPermissions=new HashSet<String>(dis.loadedPermissions);
          p.disabledComponents=new HashSet<String>(dis.disabledComponents);
          p.enabledComponents=new HashSet<String>(dis.enabledComponents);
          addUserIdLP(p.userId,p,name);
        }
 else {
          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) {
      addPackageSettingLP(p,name,sharedUser);
    }
  }
  return p;
}

Fixed version (ground truth):
private PackageSetting getPackageLP(String name,PackageSetting origPackage,String realName,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)) {
      if ((p != null) && ((p.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0)) {
        Log.w(TAG,"String_Node_Str" + p.codePathString + "String_Node_Str"+ codePath.toString());
      }
 else {
        Log.i(TAG,"String_Node_Str" + name + "String_Node_Str"+ p.codePath+ "String_Node_Str"+ codePath+ "String_Node_Str");
      }
    }
    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;
    }
 else {
      if ((pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0) {
        p.pkgFlags|=ApplicationInfo.FLAG_SYSTEM;
      }
    }
  }
  if (p == null) {
    if (!create) {
      return null;
    }
    if (origPackage != null) {
      p=new PackageSetting(origPackage.name,name,codePath,resourcePath,vc,pkgFlags);
      if (DEBUG_UPGRADE)       Log.v(TAG,"String_Node_Str" + name + "String_Node_Str"+ origPackage.name);
      p.copyFrom(origPackage);
      p.sharedUser=origPackage.sharedUser;
      p.userId=origPackage.userId;
      p.origPackage=origPackage;
      mRenamedPackages.put(name,origPackage.name);
      name=origPackage.name;
      p.setTimeStamp(codePath.lastModified());
    }
 else {
      p=new PackageSetting(name,realName,codePath,resourcePath,vc,pkgFlags);
      p.setTimeStamp(codePath.lastModified());
      p.sharedUser=sharedUser;
      if (sharedUser != null) {
        p.userId=sharedUser.userId;
      }
 else       if (MULTIPLE_APPLICATION_UIDS) {
        PackageSetting dis=mDisabledSysPackages.get(name);
        if (dis != null) {
          if (dis.signatures.mSignatures != null) {
            p.signatures.mSignatures=dis.signatures.mSignatures.clone();
          }
          p.userId=dis.userId;
          p.grantedPermissions=new HashSet<String>(dis.grantedPermissions);
          p.loadedPermissions=new HashSet<String>(dis.loadedPermissions);
          p.disabledComponents=new HashSet<String>(dis.disabledComponents);
          p.enabledComponents=new HashSet<String>(dis.enabledComponents);
          addUserIdLP(p.userId,p,name);
        }
 else {
          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) {
      addPackageSettingLP(p,name,sharedUser);
    }
  }
  return p;
}