Program: 163837
Project: 163837
Buggy source:
private void handleUpdateLayout(){
  final String timeLastSyncText;
  final String syncStatusText;
  final int syncStatusDrawable;
  if (timeLastSync == -1) {
    timeLastSyncView.setVisibility(GONE);
    syncStatusView.setText(getContext().getString(R.string.status_header_sync_in_progress));
    syncStatusView.setCompoundDrawablesWithIntrinsicBounds(0,R.drawable.sync_in_progress,0,0);
    invalidate();
    return;
  }
 else {
    DateFormat formatter=DateFormat.getDateTimeInstance();
    timeLastSyncText=formatter.format(new Date(timeLastSync));
    timeLastSyncView.setText(getContext().getString(R.string.status_header_sync_time,timeLastSyncText));
    timeLastSyncView.setVisibility(VISIBLE);
  }
  if (syncServerHasError) {
    if (account.isPresent() && DavAccountHelper.isUsingOurServers(account.get()))     syncStatusText=getContext().getString(R.string.status_header_status_our_sync_service_error);
 else     syncStatusText=getContext().getString(R.string.status_header_status_their_sync_service_error);
    syncStatusDrawable=R.drawable.sad_cloud;
  }
 else   if (registrationServerHasError) {
    syncStatusText=getContext().getString(R.string.status_header_status_registration_service_error);
    syncStatusDrawable=R.drawable.sad_cloud;
  }
 else   if (!DavAccountHelper.getAccountPassword(getContext()).isPresent()) {
    syncStatusText=getContext().getString(R.string.status_header_status_account_login_failed);
    syncStatusDrawable=R.drawable.sad_cloud;
    if (!authNotificationShown) {
      AbstractDavSyncAdapter.showAuthNotificationAndInvalidatePassword(getContext());
      authNotificationShown=true;
    }
  }
 else   if (!cipherPassphraseIsValid) {
    syncStatusText=getContext().getString(R.string.status_header_status_encryption_password_incorrect);
    syncStatusDrawable=R.drawable.sad_cloud;
  }
 else   if (!subscriptionIsValid) {
    syncStatusText=getContext().getString(R.string.notification_flock_subscription_expired);
    syncStatusDrawable=R.drawable.sad_cloud;
    if (!subscriptionNotificationShown) {
      AbstractDavSyncAdapter.showSubscriptionExpiredNotification(getContext());
      subscriptionNotificationShown=true;
    }
  }
 else   if (!cardIsValid) {
    syncStatusText=getContext().getString(R.string.status_header_status_auto_renew_error);
    syncStatusDrawable=R.drawable.sad_cloud;
  }
 else   if (!ContentResolver.getMasterSyncAutomatically()) {
    syncStatusText=getContext().getString(R.string.status_header_status_sync_disabled);
    syncStatusDrawable=R.drawable.sad_cloud;
  }
 else   if (syncInProgress) {
    syncStatusText=getContext().getString(R.string.status_header_sync_in_progress);
    syncStatusDrawable=R.drawable.sync_in_progress;
  }
 else {
    syncStatusText=getContext().getString(R.string.status_header_status_good);
    syncStatusDrawable=R.drawable.happy_cloud;
  }
  syncStatusView.setText(syncStatusText);
  syncStatusView.setCompoundDrawablesWithIntrinsicBounds(0,syncStatusDrawable,0,0);
  invalidate();
}

Fixed version (ground truth):
private void handleUpdateLayout(){
  final String timeLastSyncText;
  final String syncStatusText;
  final int syncStatusDrawable;
  if (timeLastSync == -1) {
    if (!ContentResolver.getMasterSyncAutomatically()) {
      syncStatusView.setText(getContext().getString(R.string.status_header_status_sync_disabled));
      syncStatusView.setCompoundDrawablesWithIntrinsicBounds(0,R.drawable.sad_cloud,0,0);
    }
 else {
      syncStatusView.setText(getContext().getString(R.string.status_header_sync_in_progress));
      syncStatusView.setCompoundDrawablesWithIntrinsicBounds(0,R.drawable.sync_in_progress,0,0);
    }
    timeLastSyncView.setVisibility(GONE);
    invalidate();
    return;
  }
 else {
    DateFormat formatter=DateFormat.getDateTimeInstance();
    timeLastSyncText=formatter.format(new Date(timeLastSync));
    timeLastSyncView.setText(getContext().getString(R.string.status_header_sync_time,timeLastSyncText));
    timeLastSyncView.setVisibility(VISIBLE);
  }
  if (syncServerHasError) {
    if (account.isPresent() && DavAccountHelper.isUsingOurServers(account.get()))     syncStatusText=getContext().getString(R.string.status_header_status_our_sync_service_error);
 else     syncStatusText=getContext().getString(R.string.status_header_status_their_sync_service_error);
    syncStatusDrawable=R.drawable.sad_cloud;
  }
 else   if (registrationServerHasError) {
    syncStatusText=getContext().getString(R.string.status_header_status_registration_service_error);
    syncStatusDrawable=R.drawable.sad_cloud;
  }
 else   if (!DavAccountHelper.getAccountPassword(getContext()).isPresent()) {
    syncStatusText=getContext().getString(R.string.status_header_status_account_login_failed);
    syncStatusDrawable=R.drawable.sad_cloud;
    if (!authNotificationShown) {
      AbstractDavSyncAdapter.showAuthNotificationAndInvalidatePassword(getContext());
      authNotificationShown=true;
    }
  }
 else   if (!cipherPassphraseIsValid) {
    syncStatusText=getContext().getString(R.string.status_header_status_encryption_password_incorrect);
    syncStatusDrawable=R.drawable.sad_cloud;
  }
 else   if (!subscriptionIsValid) {
    syncStatusText=getContext().getString(R.string.notification_flock_subscription_expired);
    syncStatusDrawable=R.drawable.sad_cloud;
    if (!subscriptionNotificationShown) {
      AbstractDavSyncAdapter.showSubscriptionExpiredNotification(getContext());
      subscriptionNotificationShown=true;
    }
  }
 else   if (!cardIsValid) {
    syncStatusText=getContext().getString(R.string.status_header_status_auto_renew_error);
    syncStatusDrawable=R.drawable.sad_cloud;
  }
 else   if (!ContentResolver.getMasterSyncAutomatically()) {
    syncStatusText=getContext().getString(R.string.status_header_status_sync_disabled);
    syncStatusDrawable=R.drawable.sad_cloud;
  }
 else   if (syncInProgress) {
    syncStatusText=getContext().getString(R.string.status_header_sync_in_progress);
    syncStatusDrawable=R.drawable.sync_in_progress;
  }
 else {
    syncStatusText=getContext().getString(R.string.status_header_status_good);
    syncStatusDrawable=R.drawable.happy_cloud;
  }
  syncStatusView.setText(syncStatusText);
  syncStatusView.setCompoundDrawablesWithIntrinsicBounds(0,syncStatusDrawable,0,0);
  invalidate();
}