Program: 1525
Project: 1525
Buggy source:
private Activity parseActivityAlias(Package owner,Resources res,XmlPullParser parser,AttributeSet attrs,int flags,String[] outError) throws XmlPullParserException, IOException {
  TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestActivityAlias);
  String targetActivity=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestActivityAlias_targetActivity,0);
  if (targetActivity == null) {
    outError[0]="String_Node_Str";
    sa.recycle();
    return null;
  }
  targetActivity=buildClassName(owner.applicationInfo.packageName,targetActivity,outError);
  if (targetActivity == null) {
    sa.recycle();
    return null;
  }
  if (mParseActivityAliasArgs == null) {
    mParseActivityAliasArgs=new ParseComponentArgs(owner,outError,com.android.internal.R.styleable.AndroidManifestActivityAlias_name,com.android.internal.R.styleable.AndroidManifestActivityAlias_label,com.android.internal.R.styleable.AndroidManifestActivityAlias_icon,com.android.internal.R.styleable.AndroidManifestActivityAlias_logo,mSeparateProcesses,0,com.android.internal.R.styleable.AndroidManifestActivityAlias_description,com.android.internal.R.styleable.AndroidManifestActivityAlias_enabled);
    mParseActivityAliasArgs.tag="String_Node_Str";
  }
  mParseActivityAliasArgs.sa=sa;
  mParseActivityAliasArgs.flags=flags;
  Activity target=null;
  final int NA=owner.activities.size();
  for (int i=0; i < NA; i++) {
    Activity t=owner.activities.get(i);
    if (targetActivity.equals(t.info.name)) {
      target=t;
      break;
    }
  }
  if (target == null) {
    outError[0]="String_Node_Str" + targetActivity + "String_Node_Str";
    sa.recycle();
    return null;
  }
  ActivityInfo info=new ActivityInfo();
  info.targetActivity=targetActivity;
  info.configChanges=target.info.configChanges;
  info.flags=target.info.flags;
  info.icon=target.info.icon;
  info.logo=target.info.logo;
  info.labelRes=target.info.labelRes;
  info.nonLocalizedLabel=target.info.nonLocalizedLabel;
  info.launchMode=target.info.launchMode;
  info.processName=target.info.processName;
  if (info.descriptionRes == 0) {
    info.descriptionRes=target.info.descriptionRes;
  }
  info.screenOrientation=target.info.screenOrientation;
  info.taskAffinity=target.info.taskAffinity;
  info.theme=target.info.theme;
  info.softInputMode=target.info.softInputMode;
  info.uiOptions=target.info.uiOptions;
  info.parentActivityName=target.info.parentActivityName;
  Activity a=new Activity(mParseActivityAliasArgs,info);
  if (outError[0] != null) {
    sa.recycle();
    return null;
  }
  final boolean setExported=sa.hasValue(com.android.internal.R.styleable.AndroidManifestActivityAlias_exported);
  if (setExported) {
    a.info.exported=sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivityAlias_exported,false);
  }
  String str;
  str=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestActivityAlias_permission,0);
  if (str != null) {
    a.info.permission=str.length() > 0 ? str.toString().intern() : null;
  }
  String parentName=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestActivityAlias_parentActivityName,0);
  if (parentName != null) {
    String parentClassName=buildClassName(a.info.packageName,parentName,outError);
    if (outError[0] == null) {
      a.info.parentActivityName=parentClassName;
    }
 else {
      Log.e(TAG,"String_Node_Str" + a.info.name + "String_Node_Str"+ parentName);
      outError[0]=null;
    }
  }
  sa.recycle();
  if (outError[0] != null) {
    return null;
  }
  int outerDepth=parser.getDepth();
  int type;
  while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
      continue;
    }
    if (parser.getName().equals("String_Node_Str")) {
      ActivityIntentInfo intent=new ActivityIntentInfo(a);
      if (!parseIntent(res,parser,attrs,true,intent,outError)) {
        return null;
      }
      if (intent.countActions() == 0) {
        Slog.w(TAG,"String_Node_Str" + mArchiveSourcePath + "String_Node_Str"+ parser.getPositionDescription());
      }
 else {
        a.intents.add(intent);
      }
    }
 else     if (parser.getName().equals("String_Node_Str")) {
      if ((a.metaData=parseMetaData(res,parser,attrs,a.metaData,outError)) == null) {
        return null;
      }
    }
 else {
      if (!RIGID_PARSER) {
        Slog.w(TAG,"String_Node_Str" + parser.getName() + "String_Node_Str"+ mArchiveSourcePath+ "String_Node_Str"+ parser.getPositionDescription());
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else {
        outError[0]="String_Node_Str" + parser.getName();
        return null;
      }
    }
  }
  if (!setExported) {
    a.info.exported=a.intents.size() > 0;
  }
  return a;
}

Fixed version (ground truth):
private Activity parseActivityAlias(Package owner,Resources res,XmlPullParser parser,AttributeSet attrs,int flags,String[] outError) throws XmlPullParserException, IOException {
  TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestActivityAlias);
  String targetActivity=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestActivityAlias_targetActivity,Configuration.NATIVE_CONFIG_VERSION);
  if (targetActivity == null) {
    outError[0]="String_Node_Str";
    sa.recycle();
    return null;
  }
  targetActivity=buildClassName(owner.applicationInfo.packageName,targetActivity,outError);
  if (targetActivity == null) {
    sa.recycle();
    return null;
  }
  if (mParseActivityAliasArgs == null) {
    mParseActivityAliasArgs=new ParseComponentArgs(owner,outError,com.android.internal.R.styleable.AndroidManifestActivityAlias_name,com.android.internal.R.styleable.AndroidManifestActivityAlias_label,com.android.internal.R.styleable.AndroidManifestActivityAlias_icon,com.android.internal.R.styleable.AndroidManifestActivityAlias_logo,mSeparateProcesses,0,com.android.internal.R.styleable.AndroidManifestActivityAlias_description,com.android.internal.R.styleable.AndroidManifestActivityAlias_enabled);
    mParseActivityAliasArgs.tag="String_Node_Str";
  }
  mParseActivityAliasArgs.sa=sa;
  mParseActivityAliasArgs.flags=flags;
  Activity target=null;
  final int NA=owner.activities.size();
  for (int i=0; i < NA; i++) {
    Activity t=owner.activities.get(i);
    if (targetActivity.equals(t.info.name)) {
      target=t;
      break;
    }
  }
  if (target == null) {
    outError[0]="String_Node_Str" + targetActivity + "String_Node_Str";
    sa.recycle();
    return null;
  }
  ActivityInfo info=new ActivityInfo();
  info.targetActivity=targetActivity;
  info.configChanges=target.info.configChanges;
  info.flags=target.info.flags;
  info.icon=target.info.icon;
  info.logo=target.info.logo;
  info.labelRes=target.info.labelRes;
  info.nonLocalizedLabel=target.info.nonLocalizedLabel;
  info.launchMode=target.info.launchMode;
  info.processName=target.info.processName;
  if (info.descriptionRes == 0) {
    info.descriptionRes=target.info.descriptionRes;
  }
  info.screenOrientation=target.info.screenOrientation;
  info.taskAffinity=target.info.taskAffinity;
  info.theme=target.info.theme;
  info.softInputMode=target.info.softInputMode;
  info.uiOptions=target.info.uiOptions;
  info.parentActivityName=target.info.parentActivityName;
  Activity a=new Activity(mParseActivityAliasArgs,info);
  if (outError[0] != null) {
    sa.recycle();
    return null;
  }
  final boolean setExported=sa.hasValue(com.android.internal.R.styleable.AndroidManifestActivityAlias_exported);
  if (setExported) {
    a.info.exported=sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivityAlias_exported,false);
  }
  String str;
  str=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestActivityAlias_permission,0);
  if (str != null) {
    a.info.permission=str.length() > 0 ? str.toString().intern() : null;
  }
  String parentName=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestActivityAlias_parentActivityName,Configuration.NATIVE_CONFIG_VERSION);
  if (parentName != null) {
    String parentClassName=buildClassName(a.info.packageName,parentName,outError);
    if (outError[0] == null) {
      a.info.parentActivityName=parentClassName;
    }
 else {
      Log.e(TAG,"String_Node_Str" + a.info.name + "String_Node_Str"+ parentName);
      outError[0]=null;
    }
  }
  sa.recycle();
  if (outError[0] != null) {
    return null;
  }
  int outerDepth=parser.getDepth();
  int type;
  while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
      continue;
    }
    if (parser.getName().equals("String_Node_Str")) {
      ActivityIntentInfo intent=new ActivityIntentInfo(a);
      if (!parseIntent(res,parser,attrs,true,intent,outError)) {
        return null;
      }
      if (intent.countActions() == 0) {
        Slog.w(TAG,"String_Node_Str" + mArchiveSourcePath + "String_Node_Str"+ parser.getPositionDescription());
      }
 else {
        a.intents.add(intent);
      }
    }
 else     if (parser.getName().equals("String_Node_Str")) {
      if ((a.metaData=parseMetaData(res,parser,attrs,a.metaData,outError)) == null) {
        return null;
      }
    }
 else {
      if (!RIGID_PARSER) {
        Slog.w(TAG,"String_Node_Str" + parser.getName() + "String_Node_Str"+ mArchiveSourcePath+ "String_Node_Str"+ parser.getPositionDescription());
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
 else {
        outError[0]="String_Node_Str" + parser.getName();
        return null;
      }
    }
  }
  if (!setExported) {
    a.info.exported=a.intents.size() > 0;
  }
  return a;
}