Program: 1856
Project: 1856
Buggy source:
protected void dumpSyncState(PrintWriter pw){
  pw.print("String_Node_Str");
  pw.println(mDataConnectionIsConnected);
  pw.print("String_Node_Str");
  List<UserInfo> users=getAllUsers();
  if (users != null) {
    for (    UserInfo user : users) {
      pw.print("String_Node_Str" + user.id + "String_Node_Str"+ mSyncStorageEngine.getMasterSyncAutomatically(user.id)+ "String_Node_Str");
    }
    pw.println();
  }
  pw.print("String_Node_Str");
  pw.println(mStorageIsLow);
  final AccountAndUser[] accounts=AccountManagerService.getSingleton().getAllAccounts();
  pw.print("String_Node_Str");
  if (accounts != INITIAL_ACCOUNTS_ARRAY) {
    pw.println(accounts.length);
  }
 else {
    pw.println("String_Node_Str");
  }
  final long now=SystemClock.elapsedRealtime();
  pw.print("String_Node_Str");
  pw.print(now);
  pw.println("String_Node_Str" + formatTime(System.currentTimeMillis()) + "String_Node_Str");
  pw.print("String_Node_Str");
  pw.print(DateUtils.formatElapsedTime(mSyncRandomOffsetMillis / 1000));
  pw.println("String_Node_Str");
  pw.print("String_Node_Str");
  pw.print(DateUtils.formatElapsedTime(now / 1000));
  pw.println("String_Node_Str");
  pw.print("String_Node_Str");
  pw.print(DateUtils.formatElapsedTime(mSyncHandler.mSyncTimeTracker.timeSpentSyncing() / 1000));
  pw.print("String_Node_Str");
  pw.print(mSyncHandler.mSyncTimeTracker.mLastWasSyncing ? "String_Node_Str" : "String_Node_Str");
  pw.println("String_Node_Str");
  if (mSyncHandler.mAlarmScheduleTime != null) {
    pw.print("String_Node_Str");
    pw.print(mSyncHandler.mAlarmScheduleTime);
    pw.print("String_Node_Str");
    pw.print(DateUtils.formatElapsedTime((mSyncHandler.mAlarmScheduleTime - now) / 1000));
    pw.println("String_Node_Str");
  }
 else {
    pw.println("String_Node_Str");
  }
  pw.print("String_Node_Str");
  final StringBuilder sb=new StringBuilder();
  mSyncHandler.mSyncNotificationInfo.toString(sb);
  pw.println(sb.toString());
  pw.println();
  pw.println("String_Node_Str" + mActiveSyncContexts.size());
  final PackageManager pm=mContext.getPackageManager();
  for (  SyncManager.ActiveSyncContext activeSyncContext : mActiveSyncContexts) {
    final long durationInSeconds=(now - activeSyncContext.mStartTime) / 1000;
    pw.print("String_Node_Str");
    pw.print(DateUtils.formatElapsedTime(durationInSeconds));
    pw.print("String_Node_Str");
    pw.print(activeSyncContext.mSyncOperation.dump(pm,false));
    pw.println();
  }
synchronized (mSyncQueue) {
    sb.setLength(0);
    mSyncQueue.dump(sb);
  }
  pw.println();
  pw.print(sb.toString());
  pw.println();
  pw.println("String_Node_Str");
  for (  AccountAndUser account : accounts) {
    pw.printf("String_Node_Str",account.account.name,account.userId,account.account.type);
    pw.println("String_Node_Str");
    final PrintTable table=new PrintTable(13);
    table.set(0,0,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
    final List<RegisteredServicesCache.ServiceInfo<SyncAdapterType>> sorted=Lists.newArrayList();
    sorted.addAll(mSyncAdapters.getAllServices(account.userId));
    Collections.sort(sorted,new Comparator<RegisteredServicesCache.ServiceInfo<SyncAdapterType>>(){
      @Override public int compare(      RegisteredServicesCache.ServiceInfo<SyncAdapterType> lhs,      RegisteredServicesCache.ServiceInfo<SyncAdapterType> rhs){
        return lhs.type.authority.compareTo(rhs.type.authority);
      }
    }
);
    for (    RegisteredServicesCache.ServiceInfo<SyncAdapterType> syncAdapterType : sorted) {
      if (!syncAdapterType.type.accountType.equals(account.account.type)) {
        continue;
      }
      int row=table.getNumRows();
      SyncStorageEngine.AuthorityInfo settings=mSyncStorageEngine.getOrCreateAuthority(account.account,account.userId,syncAdapterType.type.authority);
      SyncStatusInfo status=mSyncStorageEngine.getOrCreateSyncStatus(settings);
      String authority=settings.authority;
      if (authority.length() > 50) {
        authority=authority.substring(authority.length() - 50);
      }
      table.set(row,0,authority,settings.syncable,settings.enabled);
      table.set(row,4,status.numSourceLocal,status.numSourcePoll,status.numSourcePeriodic,status.numSourceServer,status.numSourceUser,status.numSyncs,DateUtils.formatElapsedTime(status.totalElapsedTime / 1000));
      for (int i=0; i < settings.periodicSyncs.size(); i++) {
        final Pair<Bundle,Long> pair=settings.periodicSyncs.get(0);
        final String period=String.valueOf(pair.second);
        final String extras=pair.first.size() > 0 ? pair.first.toString() : "String_Node_Str";
        final String next=formatTime(status.getPeriodicSyncTime(0) + pair.second * 1000);
        table.set(row + i * 2,12,period + extras);
        table.set(row + i * 2 + 1,12,next);
      }
      int row1=row;
      if (settings.delayUntil > now) {
        table.set(row1++,12,"String_Node_Str" + (settings.delayUntil - now) / 1000);
        if (settings.backoffTime > now) {
          table.set(row1++,12,"String_Node_Str" + (settings.backoffTime - now) / 1000);
          table.set(row1++,12,settings.backoffDelay / 1000);
        }
      }
      if (status.lastSuccessTime != 0) {
        table.set(row1++,11,SyncStorageEngine.SOURCES[status.lastSuccessSource] + "String_Node_Str" + "String_Node_Str");
        table.set(row1++,11,formatTime(status.lastSuccessTime));
      }
      if (status.lastFailureTime != 0) {
        table.set(row1++,11,SyncStorageEngine.SOURCES[status.lastFailureSource] + "String_Node_Str" + "String_Node_Str");
        table.set(row1++,11,formatTime(status.lastFailureTime));
        table.set(row1++,11,status.lastFailureMesg);
      }
    }
    table.writeTo(pw);
  }
}

Fixed version (ground truth):
protected void dumpSyncState(PrintWriter pw){
  pw.print("String_Node_Str");
  pw.println(mDataConnectionIsConnected);
  pw.print("String_Node_Str");
  List<UserInfo> users=getAllUsers();
  if (users != null) {
    for (    UserInfo user : users) {
      pw.print("String_Node_Str" + user.id + "String_Node_Str"+ mSyncStorageEngine.getMasterSyncAutomatically(user.id)+ "String_Node_Str");
    }
    pw.println();
  }
  pw.print("String_Node_Str");
  pw.println(mStorageIsLow);
  final AccountAndUser[] accounts=AccountManagerService.getSingleton().getAllAccounts();
  pw.print("String_Node_Str");
  if (accounts != INITIAL_ACCOUNTS_ARRAY) {
    pw.println(accounts.length);
  }
 else {
    pw.println("String_Node_Str");
  }
  final long now=SystemClock.elapsedRealtime();
  pw.print("String_Node_Str");
  pw.print(now);
  pw.println("String_Node_Str" + formatTime(System.currentTimeMillis()) + "String_Node_Str");
  pw.print("String_Node_Str");
  pw.print(DateUtils.formatElapsedTime(mSyncRandomOffsetMillis / 1000));
  pw.println("String_Node_Str");
  pw.print("String_Node_Str");
  pw.print(DateUtils.formatElapsedTime(now / 1000));
  pw.println("String_Node_Str");
  pw.print("String_Node_Str");
  pw.print(DateUtils.formatElapsedTime(mSyncHandler.mSyncTimeTracker.timeSpentSyncing() / 1000));
  pw.print("String_Node_Str");
  pw.print(mSyncHandler.mSyncTimeTracker.mLastWasSyncing ? "String_Node_Str" : "String_Node_Str");
  pw.println("String_Node_Str");
  if (mSyncHandler.mAlarmScheduleTime != null) {
    pw.print("String_Node_Str");
    pw.print(mSyncHandler.mAlarmScheduleTime);
    pw.print("String_Node_Str");
    pw.print(DateUtils.formatElapsedTime((mSyncHandler.mAlarmScheduleTime - now) / 1000));
    pw.println("String_Node_Str");
  }
 else {
    pw.println("String_Node_Str");
  }
  pw.print("String_Node_Str");
  final StringBuilder sb=new StringBuilder();
  mSyncHandler.mSyncNotificationInfo.toString(sb);
  pw.println(sb.toString());
  pw.println();
  pw.println("String_Node_Str" + mActiveSyncContexts.size());
  final PackageManager pm=mContext.getPackageManager();
  for (  SyncManager.ActiveSyncContext activeSyncContext : mActiveSyncContexts) {
    final long durationInSeconds=(now - activeSyncContext.mStartTime) / 1000;
    pw.print("String_Node_Str");
    pw.print(DateUtils.formatElapsedTime(durationInSeconds));
    pw.print("String_Node_Str");
    pw.print(activeSyncContext.mSyncOperation.dump(pm,false));
    pw.println();
  }
synchronized (mSyncQueue) {
    sb.setLength(0);
    mSyncQueue.dump(sb);
  }
  pw.println();
  pw.print(sb.toString());
  pw.println();
  pw.println("String_Node_Str");
  for (  AccountAndUser account : accounts) {
    pw.printf("String_Node_Str",account.account.name,account.userId,account.account.type);
    pw.println("String_Node_Str");
    final PrintTable table=new PrintTable(13);
    table.set(0,0,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
    final List<RegisteredServicesCache.ServiceInfo<SyncAdapterType>> sorted=Lists.newArrayList();
    sorted.addAll(mSyncAdapters.getAllServices(account.userId));
    Collections.sort(sorted,new Comparator<RegisteredServicesCache.ServiceInfo<SyncAdapterType>>(){
      @Override public int compare(      RegisteredServicesCache.ServiceInfo<SyncAdapterType> lhs,      RegisteredServicesCache.ServiceInfo<SyncAdapterType> rhs){
        return lhs.type.authority.compareTo(rhs.type.authority);
      }
    }
);
    for (    RegisteredServicesCache.ServiceInfo<SyncAdapterType> syncAdapterType : sorted) {
      if (!syncAdapterType.type.accountType.equals(account.account.type)) {
        continue;
      }
      int row=table.getNumRows();
      Pair<AuthorityInfo,SyncStatusInfo> syncAuthoritySyncStatus=mSyncStorageEngine.getCopyOfAuthorityWithSyncStatus(account.account,account.userId,syncAdapterType.type.authority);
      SyncStorageEngine.AuthorityInfo settings=syncAuthoritySyncStatus.first;
      SyncStatusInfo status=syncAuthoritySyncStatus.second;
      String authority=settings.authority;
      if (authority.length() > 50) {
        authority=authority.substring(authority.length() - 50);
      }
      table.set(row,0,authority,settings.syncable,settings.enabled);
      table.set(row,4,status.numSourceLocal,status.numSourcePoll,status.numSourcePeriodic,status.numSourceServer,status.numSourceUser,status.numSyncs,DateUtils.formatElapsedTime(status.totalElapsedTime / 1000));
      for (int i=0; i < settings.periodicSyncs.size(); i++) {
        final Pair<Bundle,Long> pair=settings.periodicSyncs.get(i);
        final String period=String.valueOf(pair.second);
        final String extras=pair.first.size() > 0 ? pair.first.toString() : "String_Node_Str";
        final String next=formatTime(status.getPeriodicSyncTime(i) + pair.second * 1000);
        table.set(row + i * 2,12,period + extras);
        table.set(row + i * 2 + 1,12,next);
      }
      int row1=row;
      if (settings.delayUntil > now) {
        table.set(row1++,12,"String_Node_Str" + (settings.delayUntil - now) / 1000);
        if (settings.backoffTime > now) {
          table.set(row1++,12,"String_Node_Str" + (settings.backoffTime - now) / 1000);
          table.set(row1++,12,settings.backoffDelay / 1000);
        }
      }
      if (status.lastSuccessTime != 0) {
        table.set(row1++,11,SyncStorageEngine.SOURCES[status.lastSuccessSource] + "String_Node_Str" + "String_Node_Str");
        table.set(row1++,11,formatTime(status.lastSuccessTime));
      }
      if (status.lastFailureTime != 0) {
        table.set(row1++,11,SyncStorageEngine.SOURCES[status.lastFailureSource] + "String_Node_Str" + "String_Node_Str");
        table.set(row1++,11,formatTime(status.lastFailureTime));
        table.set(row1++,11,status.lastFailureMesg);
      }
    }
    table.writeTo(pw);
  }
}