Program: 195606
Project: 195606
Buggy source:
private void readPermissionsFromXml(File permFile,boolean onlyFeatures){
  FileReader permReader=null;
  try {
    permReader=new FileReader(permFile);
  }
 catch (  FileNotFoundException e) {
    Slog.w(TAG,"String_Node_Str" + permFile);
    return;
  }
  final boolean lowRam=ActivityManager.isLowRamDeviceStatic();
  try {
    XmlPullParser parser=Xml.newPullParser();
    parser.setInput(permReader);
    int type;
    while ((type=parser.next()) != parser.START_TAG && type != parser.END_DOCUMENT) {
      ;
    }
    if (type != parser.START_TAG) {
      throw new XmlPullParserException("String_Node_Str");
    }
    if (!parser.getName().equals("String_Node_Str") && !parser.getName().equals("String_Node_Str")) {
      throw new XmlPullParserException("String_Node_Str" + parser.getName() + "String_Node_Str");
    }
    while (true) {
      XmlUtils.nextElement(parser);
      if (parser.getEventType() == XmlPullParser.END_DOCUMENT) {
        break;
      }
      String name=parser.getName();
      if ("String_Node_Str".equals(name) && !onlyFeatures) {
        String gidStr=parser.getAttributeValue(null,"String_Node_Str");
        if (gidStr != null) {
          int gid=android.os.Process.getGidForName(gidStr);
          mGlobalGids=appendInt(mGlobalGids,gid);
        }
 else {
          Slog.w(TAG,"String_Node_Str" + parser.getPositionDescription());
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else       if ("String_Node_Str".equals(name) && !onlyFeatures) {
        String perm=parser.getAttributeValue(null,"String_Node_Str");
        if (perm == null) {
          Slog.w(TAG,"String_Node_Str" + parser.getPositionDescription());
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        perm=perm.intern();
        readPermission(parser,perm);
      }
 else       if ("String_Node_Str".equals(name) && !onlyFeatures) {
        String perm=parser.getAttributeValue(null,"String_Node_Str");
        if (perm == null) {
          Slog.w(TAG,"String_Node_Str" + parser.getPositionDescription());
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        String uidStr=parser.getAttributeValue(null,"String_Node_Str");
        if (uidStr == null) {
          Slog.w(TAG,"String_Node_Str" + parser.getPositionDescription());
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        int uid=Process.getUidForName(uidStr);
        if (uid < 0) {
          Slog.w(TAG,"String_Node_Str" + uidStr + "String_Node_Str"+ parser.getPositionDescription());
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        perm=perm.intern();
        ArraySet<String> perms=mSystemPermissions.get(uid);
        if (perms == null) {
          perms=new ArraySet<String>();
          mSystemPermissions.put(uid,perms);
        }
        perms.add(perm);
        XmlUtils.skipCurrentTag(parser);
      }
 else       if ("String_Node_Str".equals(name) && !onlyFeatures) {
        String lname=parser.getAttributeValue(null,"String_Node_Str");
        String lfile=parser.getAttributeValue(null,"String_Node_Str");
        if (lname == null) {
          Slog.w(TAG,"String_Node_Str" + parser.getPositionDescription());
        }
 else         if (lfile == null) {
          Slog.w(TAG,"String_Node_Str" + parser.getPositionDescription());
        }
 else {
          mSharedLibraries.put(lname,lfile);
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else       if ("String_Node_Str".equals(name)) {
        String fname=parser.getAttributeValue(null,"String_Node_Str");
        boolean allowed;
        if (!lowRam) {
          allowed=true;
        }
 else {
          String notLowRam=parser.getAttributeValue(null,"String_Node_Str");
          allowed=!"String_Node_Str".equals(notLowRam);
        }
        if (fname == null) {
          Slog.w(TAG,"String_Node_Str" + parser.getPositionDescription());
        }
 else         if (allowed) {
          FeatureInfo fi=new FeatureInfo();
          fi.name=fname;
          mAvailableFeatures.put(fname,fi);
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else       if ("String_Node_Str".equals(name)) {
        String fname=parser.getAttributeValue(null,"String_Node_Str");
        if (fname == null) {
          Slog.w(TAG,"String_Node_Str" + parser.getPositionDescription());
        }
 else {
          mUnavailableFeatures.add(fname);
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else       if ("String_Node_Str".equals(name) && !onlyFeatures) {
        String pkgname=parser.getAttributeValue(null,"String_Node_Str");
        if (pkgname == null) {
          Slog.w(TAG,"String_Node_Str" + parser.getPositionDescription());
        }
 else {
          mAllowInPowerSave.add(pkgname);
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else       if ("String_Node_Str".equals(name) && !onlyFeatures) {
        String pkgname=parser.getAttributeValue(null,"String_Node_Str");
        if (pkgname == null) {
          Slog.w(TAG,"String_Node_Str" + parser.getPositionDescription());
        }
 else {
          mFixedImeApps.add(pkgname);
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else {
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
    }
  }
 catch (  XmlPullParserException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
catch (  IOException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
 finally {
    IoUtils.closeQuietly(permReader);
  }
  for (  String fname : mUnavailableFeatures) {
    if (mAvailableFeatures.remove(fname) != null) {
      Slog.d(TAG,"String_Node_Str" + fname);
    }
  }
}

Fixed version (ground truth):
private void readPermissionsFromXml(File permFile,boolean onlyFeatures){
  FileReader permReader=null;
  try {
    permReader=new FileReader(permFile);
  }
 catch (  FileNotFoundException e) {
    Slog.w(TAG,"String_Node_Str" + permFile);
    return;
  }
  final boolean lowRam=ActivityManager.isLowRamDeviceStatic();
  try {
    XmlPullParser parser=Xml.newPullParser();
    parser.setInput(permReader);
    int type;
    while ((type=parser.next()) != parser.START_TAG && type != parser.END_DOCUMENT) {
      ;
    }
    if (type != parser.START_TAG) {
      throw new XmlPullParserException("String_Node_Str");
    }
    if (!parser.getName().equals("String_Node_Str") && !parser.getName().equals("String_Node_Str")) {
      throw new XmlPullParserException("String_Node_Str" + permFile + "String_Node_Str"+ parser.getName()+ "String_Node_Str");
    }
    while (true) {
      XmlUtils.nextElement(parser);
      if (parser.getEventType() == XmlPullParser.END_DOCUMENT) {
        break;
      }
      String name=parser.getName();
      if ("String_Node_Str".equals(name) && !onlyFeatures) {
        String gidStr=parser.getAttributeValue(null,"String_Node_Str");
        if (gidStr != null) {
          int gid=android.os.Process.getGidForName(gidStr);
          mGlobalGids=appendInt(mGlobalGids,gid);
        }
 else {
          Slog.w(TAG,"String_Node_Str" + permFile + "String_Node_Str"+ parser.getPositionDescription());
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else       if ("String_Node_Str".equals(name) && !onlyFeatures) {
        String perm=parser.getAttributeValue(null,"String_Node_Str");
        if (perm == null) {
          Slog.w(TAG,"String_Node_Str" + permFile + "String_Node_Str"+ parser.getPositionDescription());
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        perm=perm.intern();
        readPermission(parser,perm);
      }
 else       if ("String_Node_Str".equals(name) && !onlyFeatures) {
        String perm=parser.getAttributeValue(null,"String_Node_Str");
        if (perm == null) {
          Slog.w(TAG,"String_Node_Str" + permFile + "String_Node_Str"+ parser.getPositionDescription());
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        String uidStr=parser.getAttributeValue(null,"String_Node_Str");
        if (uidStr == null) {
          Slog.w(TAG,"String_Node_Str" + permFile + "String_Node_Str"+ parser.getPositionDescription());
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        int uid=Process.getUidForName(uidStr);
        if (uid < 0) {
          Slog.w(TAG,"String_Node_Str" + uidStr + "String_Node_Str"+ permFile+ "String_Node_Str"+ parser.getPositionDescription());
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
        perm=perm.intern();
        ArraySet<String> perms=mSystemPermissions.get(uid);
        if (perms == null) {
          perms=new ArraySet<String>();
          mSystemPermissions.put(uid,perms);
        }
        perms.add(perm);
        XmlUtils.skipCurrentTag(parser);
      }
 else       if ("String_Node_Str".equals(name) && !onlyFeatures) {
        String lname=parser.getAttributeValue(null,"String_Node_Str");
        String lfile=parser.getAttributeValue(null,"String_Node_Str");
        if (lname == null) {
          Slog.w(TAG,"String_Node_Str" + permFile + "String_Node_Str"+ parser.getPositionDescription());
        }
 else         if (lfile == null) {
          Slog.w(TAG,"String_Node_Str" + permFile + "String_Node_Str"+ parser.getPositionDescription());
        }
 else {
          mSharedLibraries.put(lname,lfile);
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else       if ("String_Node_Str".equals(name)) {
        String fname=parser.getAttributeValue(null,"String_Node_Str");
        boolean allowed;
        if (!lowRam) {
          allowed=true;
        }
 else {
          String notLowRam=parser.getAttributeValue(null,"String_Node_Str");
          allowed=!"String_Node_Str".equals(notLowRam);
        }
        if (fname == null) {
          Slog.w(TAG,"String_Node_Str" + permFile + "String_Node_Str"+ parser.getPositionDescription());
        }
 else         if (allowed) {
          FeatureInfo fi=new FeatureInfo();
          fi.name=fname;
          mAvailableFeatures.put(fname,fi);
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else       if ("String_Node_Str".equals(name)) {
        String fname=parser.getAttributeValue(null,"String_Node_Str");
        if (fname == null) {
          Slog.w(TAG,"String_Node_Str" + permFile + "String_Node_Str"+ parser.getPositionDescription());
        }
 else {
          mUnavailableFeatures.add(fname);
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else       if ("String_Node_Str".equals(name) && !onlyFeatures) {
        String pkgname=parser.getAttributeValue(null,"String_Node_Str");
        if (pkgname == null) {
          Slog.w(TAG,"String_Node_Str" + permFile + "String_Node_Str"+ parser.getPositionDescription());
        }
 else {
          mAllowInPowerSave.add(pkgname);
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else       if ("String_Node_Str".equals(name) && !onlyFeatures) {
        String pkgname=parser.getAttributeValue(null,"String_Node_Str");
        if (pkgname == null) {
          Slog.w(TAG,"String_Node_Str" + permFile + "String_Node_Str"+ parser.getPositionDescription());
        }
 else {
          mFixedImeApps.add(pkgname);
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else {
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
    }
  }
 catch (  XmlPullParserException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
catch (  IOException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
 finally {
    IoUtils.closeQuietly(permReader);
  }
  for (  String fname : mUnavailableFeatures) {
    if (mAvailableFeatures.remove(fname) != null) {
      Slog.d(TAG,"String_Node_Str" + fname);
    }
  }
}