Program: 181960
Project: 181960
Buggy source:
boolean readLP(){
  FileInputStream str=null;
  if (mBackupSettingsFilename.exists()) {
    try {
      str=new FileInputStream(mBackupSettingsFilename);
      mReadMessages.append("String_Node_Str");
      Log.i(TAG,"String_Node_Str");
      if (mSettingsFilename.exists()) {
        Slog.w(TAG,"String_Node_Str" + mSettingsFilename);
        mSettingsFilename.delete();
      }
    }
 catch (    java.io.IOException e) {
    }
  }
  mPastSignatures.clear();
  try {
    if (str == null) {
      if (!mSettingsFilename.exists()) {
        mReadMessages.append("String_Node_Str");
        Slog.i(TAG,"String_Node_Str");
        return false;
      }
      str=new FileInputStream(mSettingsFilename);
    }
    XmlPullParser parser=Xml.newPullParser();
    parser.setInput(str,null);
    int type;
    while ((type=parser.next()) != XmlPullParser.START_TAG && type != XmlPullParser.END_DOCUMENT) {
      ;
    }
    if (type != XmlPullParser.START_TAG) {
      mReadMessages.append("String_Node_Str");
      Slog.e(TAG,"String_Node_Str");
      return false;
    }
    int outerDepth=parser.getDepth();
    while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
      if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
        continue;
      }
      String tagName=parser.getName();
      if (tagName.equals("String_Node_Str")) {
        readPackageLP(parser);
      }
 else       if (tagName.equals("String_Node_Str")) {
        readPermissionsLP(mPermissions,parser);
      }
 else       if (tagName.equals("String_Node_Str")) {
        readPermissionsLP(mPermissionTrees,parser);
      }
 else       if (tagName.equals("String_Node_Str")) {
        readSharedUserLP(parser);
      }
 else       if (tagName.equals("String_Node_Str")) {
      }
 else       if (tagName.equals("String_Node_Str")) {
        readPreferredActivitiesLP(parser);
      }
 else       if (tagName.equals("String_Node_Str")) {
        readDisabledSysPackageLP(parser);
      }
 else       if (tagName.equals("String_Node_Str")) {
        String name=parser.getAttributeValue(null,"String_Node_Str");
        if (name != null) {
          mPackagesToBeCleaned.add(name);
        }
      }
 else       if (tagName.equals("String_Node_Str")) {
        String nname=parser.getAttributeValue(null,"String_Node_Str");
        String oname=parser.getAttributeValue(null,"String_Node_Str");
        if (nname != null && oname != null) {
          mRenamedPackages.put(nname,oname);
        }
      }
 else {
        Slog.w(TAG,"String_Node_Str" + parser.getName());
        XmlUtils.skipCurrentTag(parser);
      }
    }
    str.close();
  }
 catch (  XmlPullParserException e) {
    mReadMessages.append("String_Node_Str" + e.toString());
    Slog.e(TAG,"String_Node_Str",e);
  }
catch (  java.io.IOException e) {
    mReadMessages.append("String_Node_Str" + e.toString());
    Slog.e(TAG,"String_Node_Str",e);
  }
  int N=mPendingPackages.size();
  for (int i=0; i < N; i++) {
    final PendingPackage pp=mPendingPackages.get(i);
    Object idObj=getUserIdLP(pp.sharedId);
    if (idObj != null && idObj instanceof SharedUserSetting) {
      PackageSetting p=getPackageLP(pp.name,null,pp.realName,(SharedUserSetting)idObj,pp.codePath,pp.resourcePath,pp.versionCode,pp.pkgFlags,true,true);
      if (p == null) {
        Slog.w(TAG,"String_Node_Str" + pp.name);
        continue;
      }
      p.copyFrom(pp);
    }
 else     if (idObj != null) {
      String msg="String_Node_Str" + pp.name + "String_Node_Str"+ pp.sharedId+ "String_Node_Str";
      mReadMessages.append(msg);
      Slog.e(TAG,msg);
    }
 else {
      String msg="String_Node_Str" + pp.name + "String_Node_Str"+ pp.sharedId+ "String_Node_Str";
      mReadMessages.append(msg);
      Slog.e(TAG,msg);
    }
  }
  mPendingPackages.clear();
  mReadMessages.append("String_Node_Str" + mPackages.size() + "String_Node_Str"+ mSharedUsers.size()+ "String_Node_Str");
  return true;
}

Fixed version (ground truth):
boolean readLP(){
  FileInputStream str=null;
  if (mBackupSettingsFilename.exists()) {
    try {
      str=new FileInputStream(mBackupSettingsFilename);
      mReadMessages.append("String_Node_Str");
      Log.i(TAG,"String_Node_Str");
      if (mSettingsFilename.exists()) {
        Slog.w(TAG,"String_Node_Str" + mSettingsFilename);
        mSettingsFilename.delete();
      }
    }
 catch (    java.io.IOException e) {
    }
  }
  mPastSignatures.clear();
  try {
    if (str == null) {
      if (!mSettingsFilename.exists()) {
        mReadMessages.append("String_Node_Str");
        Slog.i(TAG,"String_Node_Str");
        return false;
      }
      str=new FileInputStream(mSettingsFilename);
    }
    XmlPullParser parser=Xml.newPullParser();
    parser.setInput(str,null);
    int type;
    while ((type=parser.next()) != XmlPullParser.START_TAG && type != XmlPullParser.END_DOCUMENT) {
      ;
    }
    if (type != XmlPullParser.START_TAG) {
      mReadMessages.append("String_Node_Str");
      Slog.e(TAG,"String_Node_Str");
      return false;
    }
    int outerDepth=parser.getDepth();
    while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
      if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
        continue;
      }
      String tagName=parser.getName();
      if (tagName.equals("String_Node_Str")) {
        readPackageLP(parser);
      }
 else       if (tagName.equals("String_Node_Str")) {
        readPermissionsLP(mPermissions,parser);
      }
 else       if (tagName.equals("String_Node_Str")) {
        readPermissionsLP(mPermissionTrees,parser);
      }
 else       if (tagName.equals("String_Node_Str")) {
        readSharedUserLP(parser);
      }
 else       if (tagName.equals("String_Node_Str")) {
      }
 else       if (tagName.equals("String_Node_Str")) {
        readPreferredActivitiesLP(parser);
      }
 else       if (tagName.equals("String_Node_Str")) {
        readDisabledSysPackageLP(parser);
      }
 else       if (tagName.equals("String_Node_Str")) {
        String name=parser.getAttributeValue(null,"String_Node_Str");
        if (name != null) {
          mPackagesToBeCleaned.add(name);
        }
      }
 else       if (tagName.equals("String_Node_Str")) {
        String nname=parser.getAttributeValue(null,"String_Node_Str");
        String oname=parser.getAttributeValue(null,"String_Node_Str");
        if (nname != null && oname != null) {
          mRenamedPackages.put(nname,oname);
        }
      }
 else       if (tagName.equals("String_Node_Str")) {
        mInternalSdkPlatform=mExternalSdkPlatform=0;
        try {
          String internal=parser.getAttributeValue(null,"String_Node_Str");
          if (internal != null) {
            mInternalSdkPlatform=Integer.parseInt(internal);
          }
          String external=parser.getAttributeValue(null,"String_Node_Str");
          if (external != null) {
            mInternalSdkPlatform=Integer.parseInt(external);
          }
        }
 catch (        NumberFormatException e) {
        }
      }
 else {
        Slog.w(TAG,"String_Node_Str" + parser.getName());
        XmlUtils.skipCurrentTag(parser);
      }
    }
    str.close();
  }
 catch (  XmlPullParserException e) {
    mReadMessages.append("String_Node_Str" + e.toString());
    Slog.e(TAG,"String_Node_Str",e);
  }
catch (  java.io.IOException e) {
    mReadMessages.append("String_Node_Str" + e.toString());
    Slog.e(TAG,"String_Node_Str",e);
  }
  int N=mPendingPackages.size();
  for (int i=0; i < N; i++) {
    final PendingPackage pp=mPendingPackages.get(i);
    Object idObj=getUserIdLP(pp.sharedId);
    if (idObj != null && idObj instanceof SharedUserSetting) {
      PackageSetting p=getPackageLP(pp.name,null,pp.realName,(SharedUserSetting)idObj,pp.codePath,pp.resourcePath,pp.versionCode,pp.pkgFlags,true,true);
      if (p == null) {
        Slog.w(TAG,"String_Node_Str" + pp.name);
        continue;
      }
      p.copyFrom(pp);
    }
 else     if (idObj != null) {
      String msg="String_Node_Str" + pp.name + "String_Node_Str"+ pp.sharedId+ "String_Node_Str";
      mReadMessages.append(msg);
      Slog.e(TAG,msg);
    }
 else {
      String msg="String_Node_Str" + pp.name + "String_Node_Str"+ pp.sharedId+ "String_Node_Str";
      mReadMessages.append(msg);
      Slog.e(TAG,msg);
    }
  }
  mPendingPackages.clear();
  mReadMessages.append("String_Node_Str" + mPackages.size() + "String_Node_Str"+ mSharedUsers.size()+ "String_Node_Str");
  return true;
}