Program: 191596
Project: 191596
Buggy source:
public void dumpCheckinLocked(PrintWriter pw,String reqPackage){
  final long now=SystemClock.uptimeMillis();
  final ArrayMap<String,SparseArray<SparseArray<PackageState>>> pkgMap=mPackages.getMap();
  pw.println("String_Node_Str");
  pw.print("String_Node_Str");
  pw.print(mTimePeriodStartClockStr);
  pw.print("String_Node_Str");
  pw.print(mTimePeriodStartRealtime);
  pw.print("String_Node_Str");
  pw.print(mRunning ? SystemClock.elapsedRealtime() : mTimePeriodEndRealtime);
  boolean partial=true;
  if ((mFlags & FLAG_SHUTDOWN) != 0) {
    pw.print("String_Node_Str");
    partial=false;
  }
  if ((mFlags & FLAG_SYSPROPS) != 0) {
    pw.print("String_Node_Str");
    partial=false;
  }
  if ((mFlags & FLAG_COMPLETE) != 0) {
    pw.print("String_Node_Str");
    partial=false;
  }
  if (partial) {
    pw.print("String_Node_Str");
  }
  pw.println();
  pw.print("String_Node_Str");
  pw.println(mRuntime);
  for (int ip=0; ip < pkgMap.size(); ip++) {
    final String pkgName=pkgMap.keyAt(ip);
    if (reqPackage != null && !reqPackage.equals(pkgName)) {
      continue;
    }
    final SparseArray<SparseArray<PackageState>> uids=pkgMap.valueAt(ip);
    for (int iu=0; iu < uids.size(); iu++) {
      final int uid=uids.keyAt(iu);
      final SparseArray<PackageState> vpkgs=uids.valueAt(iu);
      for (int iv=0; iv < vpkgs.size(); iv++) {
        final int vers=vpkgs.keyAt(iv);
        final PackageState pkgState=vpkgs.valueAt(iv);
        final int NPROCS=pkgState.mProcesses.size();
        final int NSRVS=pkgState.mServices.size();
        for (int iproc=0; iproc < NPROCS; iproc++) {
          ProcessState proc=pkgState.mProcesses.valueAt(iproc);
          proc.dumpPackageProcCheckin(pw,pkgName,uid,vers,pkgState.mProcesses.keyAt(iproc),now);
        }
        for (int isvc=0; isvc < NSRVS; isvc++) {
          final String serviceName=DumpUtils.collapseString(pkgName,pkgState.mServices.keyAt(isvc));
          final ServiceState svc=pkgState.mServices.valueAt(isvc);
          svc.dumpTimesCheckin(pw,pkgName,uid,vers,serviceName,now);
        }
      }
    }
  }
  ArrayMap<String,SparseArray<ProcessState>> procMap=mProcesses.getMap();
  for (int ip=0; ip < procMap.size(); ip++) {
    String procName=procMap.keyAt(ip);
    SparseArray<ProcessState> uids=procMap.valueAt(ip);
    for (int iu=0; iu < uids.size(); iu++) {
      final int uid=uids.keyAt(iu);
      final ProcessState procState=uids.valueAt(iu);
      procState.dumpProcCheckin(pw,procName,uid,now);
    }
  }
  pw.print("String_Node_Str");
  DumpUtils.dumpAdjTimesCheckin(pw,"String_Node_Str",mMemFactorDurations,mMemFactor,mStartTime,now);
  pw.println();
  final int sysMemUsageCount=mSysMemUsage.getKeyCount();
  if (sysMemUsageCount > 0) {
    pw.print("String_Node_Str");
    for (int i=0; i < sysMemUsageCount; i++) {
      final int key=mSysMemUsage.getKeyAt(i);
      final int type=SparseMappingTable.getIdFromKey(key);
      pw.print("String_Node_Str");
      DumpUtils.printProcStateTag(pw,type);
      for (int j=SYS_MEM_USAGE_SAMPLE_COUNT; j < SYS_MEM_USAGE_COUNT; j++) {
        if (j > SYS_MEM_USAGE_CACHED_MINIMUM) {
          pw.print("String_Node_Str");
        }
        pw.print(mSysMemUsage.getValue(key,j));
      }
    }
  }
  pw.println();
  TotalMemoryUseCollection totalMem=new TotalMemoryUseCollection(ALL_SCREEN_ADJ,ALL_MEM_ADJ);
  computeTotalMemoryUse(totalMem,now);
  pw.print("String_Node_Str");
  pw.print(totalMem.totalTime);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemCachedWeight);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemSamples);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemFreeWeight);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemSamples);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemZRamWeight);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemSamples);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemKernelWeight);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemSamples);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemNativeWeight);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemSamples);
  for (int i=0; i < STATE_COUNT; i++) {
    pw.print("String_Node_Str");
    pw.print(totalMem.processStateWeight[i]);
    pw.print("String_Node_Str");
    pw.print(totalMem.processStateSamples[i]);
  }
  pw.println();
}

Fixed version (ground truth):
public void dumpCheckinLocked(PrintWriter pw,String reqPackage){
  final long now=SystemClock.uptimeMillis();
  final ArrayMap<String,SparseArray<SparseArray<PackageState>>> pkgMap=mPackages.getMap();
  pw.println("String_Node_Str");
  pw.print("String_Node_Str");
  pw.print(mTimePeriodStartClockStr);
  pw.print("String_Node_Str");
  pw.print(mTimePeriodStartRealtime);
  pw.print("String_Node_Str");
  pw.print(mRunning ? SystemClock.elapsedRealtime() : mTimePeriodEndRealtime);
  boolean partial=true;
  if ((mFlags & FLAG_SHUTDOWN) != 0) {
    pw.print("String_Node_Str");
    partial=false;
  }
  if ((mFlags & FLAG_SYSPROPS) != 0) {
    pw.print("String_Node_Str");
    partial=false;
  }
  if ((mFlags & FLAG_COMPLETE) != 0) {
    pw.print("String_Node_Str");
    partial=false;
  }
  if (partial) {
    pw.print("String_Node_Str");
  }
  if (mHasSwappedOutPss) {
    pw.print("String_Node_Str");
  }
  pw.println();
  pw.print("String_Node_Str");
  pw.println(mRuntime);
  for (int ip=0; ip < pkgMap.size(); ip++) {
    final String pkgName=pkgMap.keyAt(ip);
    if (reqPackage != null && !reqPackage.equals(pkgName)) {
      continue;
    }
    final SparseArray<SparseArray<PackageState>> uids=pkgMap.valueAt(ip);
    for (int iu=0; iu < uids.size(); iu++) {
      final int uid=uids.keyAt(iu);
      final SparseArray<PackageState> vpkgs=uids.valueAt(iu);
      for (int iv=0; iv < vpkgs.size(); iv++) {
        final int vers=vpkgs.keyAt(iv);
        final PackageState pkgState=vpkgs.valueAt(iv);
        final int NPROCS=pkgState.mProcesses.size();
        final int NSRVS=pkgState.mServices.size();
        for (int iproc=0; iproc < NPROCS; iproc++) {
          ProcessState proc=pkgState.mProcesses.valueAt(iproc);
          proc.dumpPackageProcCheckin(pw,pkgName,uid,vers,pkgState.mProcesses.keyAt(iproc),now);
        }
        for (int isvc=0; isvc < NSRVS; isvc++) {
          final String serviceName=DumpUtils.collapseString(pkgName,pkgState.mServices.keyAt(isvc));
          final ServiceState svc=pkgState.mServices.valueAt(isvc);
          svc.dumpTimesCheckin(pw,pkgName,uid,vers,serviceName,now);
        }
      }
    }
  }
  ArrayMap<String,SparseArray<ProcessState>> procMap=mProcesses.getMap();
  for (int ip=0; ip < procMap.size(); ip++) {
    String procName=procMap.keyAt(ip);
    SparseArray<ProcessState> uids=procMap.valueAt(ip);
    for (int iu=0; iu < uids.size(); iu++) {
      final int uid=uids.keyAt(iu);
      final ProcessState procState=uids.valueAt(iu);
      procState.dumpProcCheckin(pw,procName,uid,now);
    }
  }
  pw.print("String_Node_Str");
  DumpUtils.dumpAdjTimesCheckin(pw,"String_Node_Str",mMemFactorDurations,mMemFactor,mStartTime,now);
  pw.println();
  final int sysMemUsageCount=mSysMemUsage.getKeyCount();
  if (sysMemUsageCount > 0) {
    pw.print("String_Node_Str");
    for (int i=0; i < sysMemUsageCount; i++) {
      final int key=mSysMemUsage.getKeyAt(i);
      final int type=SparseMappingTable.getIdFromKey(key);
      pw.print("String_Node_Str");
      DumpUtils.printProcStateTag(pw,type);
      for (int j=SYS_MEM_USAGE_SAMPLE_COUNT; j < SYS_MEM_USAGE_COUNT; j++) {
        if (j > SYS_MEM_USAGE_CACHED_MINIMUM) {
          pw.print("String_Node_Str");
        }
        pw.print(mSysMemUsage.getValue(key,j));
      }
    }
  }
  pw.println();
  TotalMemoryUseCollection totalMem=new TotalMemoryUseCollection(ALL_SCREEN_ADJ,ALL_MEM_ADJ);
  computeTotalMemoryUse(totalMem,now);
  pw.print("String_Node_Str");
  pw.print(totalMem.totalTime);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemCachedWeight);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemSamples);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemFreeWeight);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemSamples);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemZRamWeight);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemSamples);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemKernelWeight);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemSamples);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemNativeWeight);
  pw.print("String_Node_Str");
  pw.print(totalMem.sysMemSamples);
  for (int i=0; i < STATE_COUNT; i++) {
    pw.print("String_Node_Str");
    pw.print(totalMem.processStateWeight[i]);
    pw.print("String_Node_Str");
    pw.print(totalMem.processStateSamples[i]);
  }
  pw.println();
}