Program: 142343
Project: 142343
Buggy source:
private void refreshView() throws SessionUnavailableException {
  TextView version=(TextView)findViewById(R.id.str_version);
  version.setText(CommCareApplication._().getCurrentVersionString());
  boolean syncOK=true;
  TextView syncMessage=(TextView)findViewById(R.id.home_sync_message);
  Pair<Long,int[]> syncDetails=CommCareApplication._().getSyncDisplayParameters();
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
  unsentFormNumberLimit=Integer.parseInt(prefs.getString(UNSENT_FORM_NUMBER_KEY,"String_Node_Str"));
  unsentFormTimeLimit=Integer.parseInt(prefs.getString(UNSENT_FORM_TIME_KEY,"String_Node_Str"));
  CharSequence syncTime=syncDetails.first == 0 ? Localization.get("String_Node_Str") : DateUtils.formatSameDayTime(syncDetails.first,new Date().getTime(),DateFormat.DEFAULT,DateFormat.DEFAULT);
  String message="String_Node_Str";
  if (syncDetails.second[0] == 1) {
    message+=Localization.get("String_Node_Str") + "String_Node_Str";
  }
 else   if (syncDetails.second[0] > 1) {
    message+=Localization.get("String_Node_Str",new String[]{String.valueOf(syncDetails.second)}) + "String_Node_Str";
  }
  if (syncDetails.second[0] > 0) {
    syncButton.setText(Localization.get("String_Node_Str",new String[]{String.valueOf(syncDetails.second[0]),Localization.get("String_Node_Str")}));
  }
 else {
    syncButton.setText(Localization.get("String_Node_Str"));
  }
  if (syncDetails.second[1] > 0) {
    viewIncomplete.setText(Localization.get("String_Node_Str",new String[]{String.valueOf(syncDetails.second[1]),Localization.get("String_Node_Str")}));
    viewIncomplete.setText(Localization.get("String_Node_Str"));
  }
  if (syncDetails.second[0] > unsentFormNumberLimit) {
    syncOK=false;
  }
  long then=syncDetails.first;
  long now=new Date().getTime();
  int secs_ago=(int)((then - now) / 1000);
  int days_ago=secs_ago / 86400;
  if (days_ago > unsentFormTimeLimit) {
    syncOK=false;
  }
  int[] padding={syncMessage.getPaddingLeft(),syncMessage.getPaddingTop(),syncMessage.getPaddingRight(),syncMessage.getPaddingBottom()};
  if (!syncOK) {
    syncMessage.setTextColor(getResources().getColor(R.color.red));
    syncMessage.setTypeface(null,Typeface.BOLD);
    syncMessage.setBackgroundDrawable(getResources().getDrawable(R.drawable.bubble_danger));
  }
 else {
    syncMessage.setTextColor(getResources().getColor(R.color.solid_black));
    syncMessage.setTypeface(null,Typeface.NORMAL);
    syncMessage.setBackgroundDrawable(getResources().getDrawable(R.drawable.bubble));
  }
  syncMessage.setPadding(padding[0],padding[1],padding[2],padding[3]);
  message+=Localization.get("String_Node_Str",new String[]{syncTime.toString()});
  syncMessage.setText(message);
  Profile p=CommCareApplication._().getCommCarePlatform().getCurrentProfile();
  if (p != null && p.isFeatureActive(Profile.FEATURE_REVIEW)) {
    viewOldForms.setVisibility(Button.VISIBLE);
  }
  mDataPullTask=CommCareApplication._().getSession().getCurrentTask();
  if (mDataPullTask != null) {
    this.attachPullTask(mDataPullTask);
    if (mDataPullTask.getStatus() == Status.FINISHED) {
      this.dismissDialog(DIALOG_PROCESS);
    }
  }
  View formRecordPane=this.findViewById(R.id.home_formspanel);
  if (!CommCarePreferences.isFormManagementEnabled()) {
    formRecordPane.setVisibility(View.GONE);
  }
 else {
    formRecordPane.setVisibility(View.VISIBLE);
  }
}

Fixed version (ground truth):
private void refreshView() throws SessionUnavailableException {
  TextView version=(TextView)findViewById(R.id.str_version);
  version.setText(CommCareApplication._().getCurrentVersionString());
  boolean syncOK=true;
  TextView syncMessage=(TextView)findViewById(R.id.home_sync_message);
  Pair<Long,int[]> syncDetails=CommCareApplication._().getSyncDisplayParameters();
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
  unsentFormNumberLimit=Integer.parseInt(prefs.getString(UNSENT_FORM_NUMBER_KEY,"String_Node_Str"));
  unsentFormTimeLimit=Integer.parseInt(prefs.getString(UNSENT_FORM_TIME_KEY,"String_Node_Str"));
  CharSequence syncTime=syncDetails.first == 0 ? Localization.get("String_Node_Str") : DateUtils.formatSameDayTime(syncDetails.first,new Date().getTime(),DateFormat.DEFAULT,DateFormat.DEFAULT);
  String message="String_Node_Str";
  if (syncDetails.second[0] == 1) {
    message+=Localization.get("String_Node_Str") + "String_Node_Str";
  }
 else   if (syncDetails.second[0] > 1) {
    message+=Localization.get("String_Node_Str",new String[]{String.valueOf(syncDetails.second)}) + "String_Node_Str";
  }
  if (syncDetails.second[0] > 0) {
    syncButton.setText(Localization.get("String_Node_Str",new String[]{String.valueOf(syncDetails.second[0]),Localization.get("String_Node_Str")}));
  }
 else {
    syncButton.setText(Localization.get("String_Node_Str"));
  }
  if (syncDetails.second[1] > 0) {
    viewIncomplete.setText(Localization.get("String_Node_Str",new String[]{String.valueOf(syncDetails.second[1]),Localization.get("String_Node_Str")}));
  }
 else {
    viewIncomplete.setText(Localization.get("String_Node_Str"));
  }
  if (syncDetails.second[0] > unsentFormNumberLimit) {
    syncOK=false;
  }
  long then=syncDetails.first;
  long now=new Date().getTime();
  int secs_ago=(int)((then - now) / 1000);
  int days_ago=secs_ago / 86400;
  if (days_ago > unsentFormTimeLimit) {
    syncOK=false;
  }
  int[] padding={syncMessage.getPaddingLeft(),syncMessage.getPaddingTop(),syncMessage.getPaddingRight(),syncMessage.getPaddingBottom()};
  if (!syncOK) {
    syncMessage.setTextColor(getResources().getColor(R.color.red));
    syncMessage.setTypeface(null,Typeface.BOLD);
    syncMessage.setBackgroundDrawable(getResources().getDrawable(R.drawable.bubble_danger));
  }
 else {
    syncMessage.setTextColor(getResources().getColor(R.color.solid_black));
    syncMessage.setTypeface(null,Typeface.NORMAL);
    syncMessage.setBackgroundDrawable(getResources().getDrawable(R.drawable.bubble));
  }
  syncMessage.setPadding(padding[0],padding[1],padding[2],padding[3]);
  message+=Localization.get("String_Node_Str",new String[]{syncTime.toString()});
  syncMessage.setText(message);
  Profile p=CommCareApplication._().getCommCarePlatform().getCurrentProfile();
  if (p != null && p.isFeatureActive(Profile.FEATURE_REVIEW)) {
    viewOldForms.setVisibility(Button.VISIBLE);
  }
  mDataPullTask=CommCareApplication._().getSession().getCurrentTask();
  if (mDataPullTask != null) {
    this.attachPullTask(mDataPullTask);
    if (mDataPullTask.getStatus() == Status.FINISHED) {
      this.dismissDialog(DIALOG_PROCESS);
    }
  }
  View formRecordPane=this.findViewById(R.id.home_formspanel);
  if (!CommCarePreferences.isFormManagementEnabled()) {
    formRecordPane.setVisibility(View.GONE);
  }
 else {
    formRecordPane.setVisibility(View.VISIBLE);
  }
}