Program: 192392
Project: 192392
Buggy source:
@SuppressWarnings("String_Node_Str") public void dumpCheckinLocked(Context context,PrintWriter pw,List<ApplicationInfo> apps,int flags,long histStart){
  prepareForDumpLocked();
  dumpLine(pw,0,"String_Node_Str",VERSION_DATA,CHECKIN_VERSION,getParcelVersion(),getStartPlatformVersion(),getEndPlatformVersion());
  long now=getHistoryBaseTime() + SystemClock.elapsedRealtime();
  final boolean filtering=(flags & (DUMP_HISTORY_ONLY | DUMP_CHARGED_ONLY | DUMP_DAILY_ONLY)) != 0;
  if ((flags & DUMP_INCLUDE_HISTORY) != 0 || (flags & DUMP_HISTORY_ONLY) != 0) {
    if (startIteratingHistoryLocked()) {
      try {
        for (int i=0; i < getHistoryStringPoolSize(); i++) {
          pw.print(BATTERY_STATS_CHECKIN_VERSION);
          pw.print(',');
          pw.print(HISTORY_STRING_POOL);
          pw.print(',');
          pw.print(i);
          pw.print("String_Node_Str");
          pw.print(getHistoryTagPoolUid(i));
          pw.print("String_Node_Str");
          String str=getHistoryTagPoolString(i);
          str=str.replace("String_Node_Str","String_Node_Str");
          str=str.replace("String_Node_Str","String_Node_Str");
          pw.print(str);
          pw.print("String_Node_Str");
          pw.println();
        }
        dumpHistoryLocked(pw,flags,histStart,true);
      }
  finally {
        finishIteratingHistoryLocked();
      }
    }
  }
  if (filtering && (flags & (DUMP_CHARGED_ONLY | DUMP_DAILY_ONLY)) == 0) {
    return;
  }
  if (apps != null) {
    SparseArray<ArrayList<String>> uids=new SparseArray<ArrayList<String>>();
    for (int i=0; i < apps.size(); i++) {
      ApplicationInfo ai=apps.get(i);
      ArrayList<String> pkgs=uids.get(ai.uid);
      if (pkgs == null) {
        pkgs=new ArrayList<String>();
        uids.put(ai.uid,pkgs);
      }
      pkgs.add(ai.packageName);
    }
    SparseArray<? extends Uid> uidStats=getUidStats();
    final int NU=uidStats.size();
    String[] lineArgs=new String[2];
    for (int i=0; i < NU; i++) {
      int uid=uidStats.keyAt(i);
      ArrayList<String> pkgs=uids.get(uid);
      if (pkgs != null) {
        for (int j=0; j < pkgs.size(); j++) {
          lineArgs[0]=Integer.toString(uid);
          lineArgs[1]=pkgs.get(j);
          dumpLine(pw,0,"String_Node_Str",UID_DATA,(Object[])lineArgs);
        }
      }
    }
  }
  if (!filtering || (flags & DUMP_CHARGED_ONLY) != 0) {
    dumpDurationSteps(pw,"String_Node_Str",DISCHARGE_STEP_DATA,getDischargeLevelStepTracker(),true);
    String[] lineArgs=new String[1];
    long timeRemaining=computeBatteryTimeRemaining(SystemClock.elapsedRealtime());
    if (timeRemaining >= 0) {
      lineArgs[0]=Long.toString(timeRemaining);
      dumpLine(pw,0,"String_Node_Str",DISCHARGE_TIME_REMAIN_DATA,(Object[])lineArgs);
    }
    dumpDurationSteps(pw,"String_Node_Str",CHARGE_STEP_DATA,getChargeLevelStepTracker(),true);
    timeRemaining=computeChargeTimeRemaining(SystemClock.elapsedRealtime());
    if (timeRemaining >= 0) {
      lineArgs[0]=Long.toString(timeRemaining);
      dumpLine(pw,0,"String_Node_Str",CHARGE_TIME_REMAIN_DATA,(Object[])lineArgs);
    }
    dumpCheckinLocked(context,pw,STATS_SINCE_CHARGED,-1,(flags & DUMP_DEVICE_WIFI_ONLY) != 0);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void dumpCheckinLocked(Context context,PrintWriter pw,List<ApplicationInfo> apps,int flags,long histStart){
  prepareForDumpLocked();
  dumpLine(pw,0,"String_Node_Str",VERSION_DATA,CHECKIN_VERSION,getParcelVersion(),getStartPlatformVersion(),getEndPlatformVersion());
  long now=getHistoryBaseTime() + SystemClock.elapsedRealtime();
  final boolean filtering=(flags & (DUMP_HISTORY_ONLY | DUMP_CHARGED_ONLY | DUMP_DAILY_ONLY)) != 0;
  if ((flags & DUMP_INCLUDE_HISTORY) != 0 || (flags & DUMP_HISTORY_ONLY) != 0) {
    if (startIteratingHistoryLocked()) {
      try {
        for (int i=0; i < getHistoryStringPoolSize(); i++) {
          pw.print(BATTERY_STATS_CHECKIN_VERSION);
          pw.print(',');
          pw.print(HISTORY_STRING_POOL);
          pw.print(',');
          pw.print(i);
          pw.print("String_Node_Str");
          pw.print(getHistoryTagPoolUid(i));
          pw.print("String_Node_Str");
          String str=getHistoryTagPoolString(i);
          str=str.replace("String_Node_Str","String_Node_Str");
          str=str.replace("String_Node_Str","String_Node_Str");
          pw.print(str);
          pw.print("String_Node_Str");
          pw.println();
        }
        dumpHistoryLocked(pw,flags,histStart,true);
      }
  finally {
        finishIteratingHistoryLocked();
      }
    }
  }
  if (filtering && (flags & (DUMP_CHARGED_ONLY | DUMP_DAILY_ONLY)) == 0) {
    return;
  }
  if (apps != null) {
    SparseArray<Pair<ArrayList<String>,MutableBoolean>> uids=new SparseArray<>();
    for (int i=0; i < apps.size(); i++) {
      ApplicationInfo ai=apps.get(i);
      Pair<ArrayList<String>,MutableBoolean> pkgs=uids.get(UserHandle.getAppId(ai.uid));
      if (pkgs == null) {
        pkgs=new Pair<>(new ArrayList<String>(),new MutableBoolean(false));
        uids.put(UserHandle.getAppId(ai.uid),pkgs);
      }
      pkgs.first.add(ai.packageName);
    }
    SparseArray<? extends Uid> uidStats=getUidStats();
    final int NU=uidStats.size();
    String[] lineArgs=new String[2];
    for (int i=0; i < NU; i++) {
      int uid=UserHandle.getAppId(uidStats.keyAt(i));
      Pair<ArrayList<String>,MutableBoolean> pkgs=uids.get(uid);
      if (pkgs != null && !pkgs.second.value) {
        pkgs.second.value=true;
        for (int j=0; j < pkgs.first.size(); j++) {
          lineArgs[0]=Integer.toString(uid);
          lineArgs[1]=pkgs.first.get(j);
          dumpLine(pw,0,"String_Node_Str",UID_DATA,(Object[])lineArgs);
        }
      }
    }
  }
  if (!filtering || (flags & DUMP_CHARGED_ONLY) != 0) {
    dumpDurationSteps(pw,"String_Node_Str",DISCHARGE_STEP_DATA,getDischargeLevelStepTracker(),true);
    String[] lineArgs=new String[1];
    long timeRemaining=computeBatteryTimeRemaining(SystemClock.elapsedRealtime());
    if (timeRemaining >= 0) {
      lineArgs[0]=Long.toString(timeRemaining);
      dumpLine(pw,0,"String_Node_Str",DISCHARGE_TIME_REMAIN_DATA,(Object[])lineArgs);
    }
    dumpDurationSteps(pw,"String_Node_Str",CHARGE_STEP_DATA,getChargeLevelStepTracker(),true);
    timeRemaining=computeChargeTimeRemaining(SystemClock.elapsedRealtime());
    if (timeRemaining >= 0) {
      lineArgs[0]=Long.toString(timeRemaining);
      dumpLine(pw,0,"String_Node_Str",CHARGE_TIME_REMAIN_DATA,(Object[])lineArgs);
    }
    dumpCheckinLocked(context,pw,STATS_SINCE_CHARGED,-1,(flags & DUMP_DEVICE_WIFI_ONLY) != 0);
  }
}