Program: 41354
Project: 41354
Buggy source:
/** 
 * Dumps a human-readable summary of the battery statistics to the given PrintWriter.
 * @param pw a Printer to receive the dump output.
 */
@SuppressWarnings("String_Node_Str") public void dumpLocked(PrintWriter pw){
  HistoryItem rec=getHistory();
  if (rec != null) {
    pw.println("String_Node_Str");
    int oldState=0;
    int oldStatus=-1;
    int oldHealth=-1;
    int oldPlug=-1;
    int oldTemp=-1;
    int oldVolt=-1;
    while (rec != null) {
      pw.print("String_Node_Str");
      pw.print(rec.time);
      pw.print("String_Node_Str");
      if (rec.cmd == HistoryItem.CMD_START) {
        pw.println("String_Node_Str");
      }
 else {
        if (rec.batteryLevel < 10)         pw.print("String_Node_Str");
 else         if (rec.batteryLevel < 100)         pw.print("String_Node_Str");
        pw.print(rec.batteryLevel);
        pw.print("String_Node_Str");
        if (rec.states < 0x10)         pw.print("String_Node_Str");
 else         if (rec.states < 0x100)         pw.print("String_Node_Str");
 else         if (rec.states < 0x1000)         pw.print("String_Node_Str");
 else         if (rec.states < 0x10000)         pw.print("String_Node_Str");
 else         if (rec.states < 0x100000)         pw.print("String_Node_Str");
 else         if (rec.states < 0x1000000)         pw.print("String_Node_Str");
 else         if (rec.states < 0x10000000)         pw.print("String_Node_Str");
        pw.print(Integer.toHexString(rec.states));
        if (oldStatus != rec.batteryStatus) {
          oldStatus=rec.batteryStatus;
          pw.print("String_Node_Str");
switch (oldStatus) {
case BatteryManager.BATTERY_STATUS_UNKNOWN:
            pw.print("String_Node_Str");
          break;
case BatteryManager.BATTERY_STATUS_CHARGING:
        pw.print("String_Node_Str");
      break;
case BatteryManager.BATTERY_STATUS_DISCHARGING:
    pw.print("String_Node_Str");
  break;
case BatteryManager.BATTERY_STATUS_NOT_CHARGING:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_STATUS_FULL:
pw.print("String_Node_Str");
break;
default :
pw.print(oldStatus);
break;
}
}
if (oldHealth != rec.batteryHealth) {
oldHealth=rec.batteryHealth;
pw.print("String_Node_Str");
switch (oldHealth) {
case BatteryManager.BATTERY_HEALTH_UNKNOWN:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_HEALTH_GOOD:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_HEALTH_OVERHEAT:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_HEALTH_DEAD:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE:
pw.print("String_Node_Str");
break;
default :
pw.print(oldHealth);
break;
}
}
if (oldPlug != rec.batteryPlugType) {
oldPlug=rec.batteryPlugType;
pw.print("String_Node_Str");
switch (oldPlug) {
case 0:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_PLUGGED_AC:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_PLUGGED_USB:
pw.print("String_Node_Str");
break;
default :
pw.print(oldPlug);
break;
}
}
if (oldTemp != rec.batteryTemperature) {
oldTemp=rec.batteryTemperature;
pw.print("String_Node_Str");
pw.print(oldTemp);
}
if (oldVolt != rec.batteryVoltage) {
oldVolt=rec.batteryVoltage;
pw.print("String_Node_Str");
pw.print(oldVolt);
}
printBitDescriptions(pw,oldState,rec.states,HISTORY_STATE_DESCRIPTIONS);
pw.println();
}
oldState=rec.states;
rec=rec.next;
}
}
pw.println("String_Node_Str");
pw.println("String_Node_Str" + getStartCount() + "String_Node_Str"+ getIsOnBattery());
dumpLocked(pw,"String_Node_Str",STATS_SINCE_CHARGED,-1);
pw.println("String_Node_Str");
pw.println("String_Node_Str");
dumpLocked(pw,"String_Node_Str",STATS_SINCE_UNPLUGGED,-1);
}

Fixed version (ground truth):
/** 
 * Dumps a human-readable summary of the battery statistics to the given PrintWriter.
 * @param pw a Printer to receive the dump output.
 */
@SuppressWarnings("String_Node_Str") public void dumpLocked(PrintWriter pw){
  HistoryItem rec=getHistory();
  if (rec != null) {
    pw.println("String_Node_Str");
    long now=getHistoryBaseTime() + SystemClock.elapsedRealtime();
    int oldState=0;
    int oldStatus=-1;
    int oldHealth=-1;
    int oldPlug=-1;
    int oldTemp=-1;
    int oldVolt=-1;
    while (rec != null) {
      pw.print("String_Node_Str");
      TimeUtils.formatDuration(rec.time - now,pw,TimeUtils.HUNDRED_DAY_FIELD_LEN);
      pw.print("String_Node_Str");
      if (rec.cmd == HistoryItem.CMD_START) {
        pw.println("String_Node_Str");
      }
 else {
        if (rec.batteryLevel < 10)         pw.print("String_Node_Str");
 else         if (rec.batteryLevel < 100)         pw.print("String_Node_Str");
        pw.print(rec.batteryLevel);
        pw.print("String_Node_Str");
        if (rec.states < 0x10)         pw.print("String_Node_Str");
 else         if (rec.states < 0x100)         pw.print("String_Node_Str");
 else         if (rec.states < 0x1000)         pw.print("String_Node_Str");
 else         if (rec.states < 0x10000)         pw.print("String_Node_Str");
 else         if (rec.states < 0x100000)         pw.print("String_Node_Str");
 else         if (rec.states < 0x1000000)         pw.print("String_Node_Str");
 else         if (rec.states < 0x10000000)         pw.print("String_Node_Str");
        pw.print(Integer.toHexString(rec.states));
        if (oldStatus != rec.batteryStatus) {
          oldStatus=rec.batteryStatus;
          pw.print("String_Node_Str");
switch (oldStatus) {
case BatteryManager.BATTERY_STATUS_UNKNOWN:
            pw.print("String_Node_Str");
          break;
case BatteryManager.BATTERY_STATUS_CHARGING:
        pw.print("String_Node_Str");
      break;
case BatteryManager.BATTERY_STATUS_DISCHARGING:
    pw.print("String_Node_Str");
  break;
case BatteryManager.BATTERY_STATUS_NOT_CHARGING:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_STATUS_FULL:
pw.print("String_Node_Str");
break;
default :
pw.print(oldStatus);
break;
}
}
if (oldHealth != rec.batteryHealth) {
oldHealth=rec.batteryHealth;
pw.print("String_Node_Str");
switch (oldHealth) {
case BatteryManager.BATTERY_HEALTH_UNKNOWN:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_HEALTH_GOOD:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_HEALTH_OVERHEAT:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_HEALTH_DEAD:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE:
pw.print("String_Node_Str");
break;
default :
pw.print(oldHealth);
break;
}
}
if (oldPlug != rec.batteryPlugType) {
oldPlug=rec.batteryPlugType;
pw.print("String_Node_Str");
switch (oldPlug) {
case 0:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_PLUGGED_AC:
pw.print("String_Node_Str");
break;
case BatteryManager.BATTERY_PLUGGED_USB:
pw.print("String_Node_Str");
break;
default :
pw.print(oldPlug);
break;
}
}
if (oldTemp != rec.batteryTemperature) {
oldTemp=rec.batteryTemperature;
pw.print("String_Node_Str");
pw.print(oldTemp);
}
if (oldVolt != rec.batteryVoltage) {
oldVolt=rec.batteryVoltage;
pw.print("String_Node_Str");
pw.print(oldVolt);
}
printBitDescriptions(pw,oldState,rec.states,HISTORY_STATE_DESCRIPTIONS);
pw.println();
}
oldState=rec.states;
rec=rec.next;
}
pw.println("String_Node_Str");
}
SparseArray<? extends Uid> uidStats=getUidStats();
final int NU=uidStats.size();
boolean didPid=false;
long nowRealtime=SystemClock.elapsedRealtime();
StringBuilder sb=new StringBuilder(64);
for (int i=0; i < NU; i++) {
Uid uid=uidStats.valueAt(i);
SparseArray<? extends Uid.Pid> pids=uid.getPidStats();
if (pids != null) {
for (int j=0; j < pids.size(); j++) {
Uid.Pid pid=pids.valueAt(j);
if (!didPid) {
pw.println("String_Node_Str");
didPid=true;
}
long time=pid.mWakeSum + (pid.mWakeStart != 0 ? (nowRealtime - pid.mWakeStart) : 0);
pw.print("String_Node_Str");
pw.print(pids.keyAt(j));
pw.print("String_Node_Str");
TimeUtils.formatDuration(time,pw);
pw.println("String_Node_Str");
}
}
}
if (didPid) {
pw.println("String_Node_Str");
}
pw.println("String_Node_Str");
pw.println("String_Node_Str" + getStartCount() + "String_Node_Str"+ getIsOnBattery());
dumpLocked(pw,"String_Node_Str",STATS_SINCE_CHARGED,-1);
pw.println("String_Node_Str");
pw.println("String_Node_Str");
dumpLocked(pw,"String_Node_Str",STATS_SINCE_UNPLUGGED,-1);
}