Program: 8357
Project: 8357
Buggy source:
/** 
 * Creates dialog
 */
@Override public Dialog onCreateDialog(Bundle savedInstanceState){
  final Activity activity=getActivity();
  mMessenger=getArguments().getParcelable(ARG_MESSENGER);
  Date creationDate=new Date(getArguments().getLong(ARG_CREATION_DATE) * 1000);
  Date expiryDate=new Date(getArguments().getLong(ARG_EXPIRY_DATE) * 1000);
  Calendar creationCal=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
  creationCal.setTime(creationDate);
  mExpiryCal=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
  mExpiryCal.setTime(expiryDate);
  Log.d(Constants.TAG,"String_Node_Str");
  CustomAlertDialogBuilder alert=new CustomAlertDialogBuilder(activity);
  alert.setTitle(R.string.expiry_date_dialog_title);
  LayoutInflater inflater=activity.getLayoutInflater();
  View view=inflater.inflate(R.layout.edit_subkey_expiry_dialog,null);
  alert.setView(view);
  mDatePicker=(DatePicker)view.findViewById(R.id.edit_subkey_expiry_date_picker);
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
    if (creationCal.before(mExpiryCal)) {
      mDatePicker.setMinDate(creationCal.getTime().getTime() + DateUtils.DAY_IN_MILLIS);
    }
 else {
      mDatePicker.setMinDate(mExpiryCal.getTime().getTime() + DateUtils.DAY_IN_MILLIS);
    }
  }
  alert.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int id){
      dismiss();
      Calendar selectedCal=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
      selectedCal.set(mDatePicker.getYear(),mDatePicker.getMonth(),mDatePicker.getDayOfMonth());
      if (mExpiryCal != null) {
        long numDays=(selectedCal.getTimeInMillis() / 86400000) - (mExpiryCal.getTimeInMillis() / 86400000);
        if (numDays > 0) {
          Bundle data=new Bundle();
          data.putSerializable(MESSAGE_DATA_EXPIRY_DATE,selectedCal.getTime().getTime() / 1000);
          sendMessageToHandler(MESSAGE_NEW_EXPIRY_DATE,data);
        }
      }
 else {
        Bundle data=new Bundle();
        data.putSerializable(MESSAGE_DATA_EXPIRY_DATE,selectedCal.getTime().getTime() / 1000);
        sendMessageToHandler(MESSAGE_NEW_EXPIRY_DATE,data);
      }
    }
  }
);
  alert.setNeutralButton(R.string.btn_no_date,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int id){
      dismiss();
      Bundle data=new Bundle();
      data.putSerializable(MESSAGE_DATA_EXPIRY_DATE,0L);
      sendMessageToHandler(MESSAGE_NEW_EXPIRY_DATE,data);
    }
  }
);
  alert.setNegativeButton(android.R.string.cancel,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int id){
      dismiss();
    }
  }
);
  return alert.show();
}

Fixed version (ground truth):
/** 
 * Creates dialog
 */
@Override public Dialog onCreateDialog(Bundle savedInstanceState){
  final Activity activity=getActivity();
  mMessenger=getArguments().getParcelable(ARG_MESSENGER);
  long creationDate=getArguments().getLong(ARG_CREATION_DATE);
  long expiryDate=getArguments().getLong(ARG_EXPIRY_DATE);
  Calendar creationCal=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
  creationCal.setTime(new Date(creationDate * 1000));
  final Calendar expiryCal=Calendar.getInstance(TimeZone.getTimeZone("String_Node_Str"));
  expiryCal.setTime(new Date(expiryDate * 1000));
  creationCal.setTimeZone(TimeZone.getDefault());
  expiryCal.setTimeZone(TimeZone.getDefault());
  CustomAlertDialogBuilder alert=new CustomAlertDialogBuilder(activity);
  alert.setTitle(R.string.expiry_date_dialog_title);
  LayoutInflater inflater=activity.getLayoutInflater();
  View view=inflater.inflate(R.layout.edit_subkey_expiry_dialog,null);
  alert.setView(view);
  mDatePicker=(DatePicker)view.findViewById(R.id.edit_subkey_expiry_date_picker);
  if (expiryDate == 0L) {
    Calendar creationCalPlusOne=(Calendar)creationCal.clone();
    creationCalPlusOne.add(Calendar.DAY_OF_MONTH,1);
    mDatePicker.init(creationCalPlusOne.get(Calendar.YEAR),creationCalPlusOne.get(Calendar.MONTH),creationCalPlusOne.get(Calendar.DAY_OF_MONTH),null);
  }
 else {
    Calendar expiryCalPlusOne=(Calendar)expiryCal.clone();
    expiryCalPlusOne.add(Calendar.DAY_OF_MONTH,1);
    mDatePicker.init(expiryCalPlusOne.get(Calendar.YEAR),expiryCalPlusOne.get(Calendar.MONTH),expiryCalPlusOne.get(Calendar.DAY_OF_MONTH),null);
  }
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
    if (expiryDate == 0L || creationCal.before(expiryCal)) {
      mDatePicker.setMinDate(creationCal.getTime().getTime() + DateUtils.DAY_IN_MILLIS);
    }
 else {
      mDatePicker.setMinDate(expiryCal.getTime().getTime() + DateUtils.DAY_IN_MILLIS);
    }
  }
  alert.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int id){
      dismiss();
      Calendar selectedCal=Calendar.getInstance(TimeZone.getDefault());
      selectedCal.set(mDatePicker.getYear(),mDatePicker.getMonth(),mDatePicker.getDayOfMonth());
      selectedCal.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
      long numDays=(selectedCal.getTimeInMillis() / 86400000) - (expiryCal.getTimeInMillis() / 86400000);
      if (numDays > 0) {
        Bundle data=new Bundle();
        data.putSerializable(MESSAGE_DATA_EXPIRY_DATE,selectedCal.getTime().getTime() / 1000);
        sendMessageToHandler(MESSAGE_NEW_EXPIRY_DATE,data);
      }
    }
  }
);
  alert.setNeutralButton(R.string.btn_no_date,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int id){
      dismiss();
      Bundle data=new Bundle();
      data.putSerializable(MESSAGE_DATA_EXPIRY_DATE,0L);
      sendMessageToHandler(MESSAGE_NEW_EXPIRY_DATE,data);
    }
  }
);
  alert.setNegativeButton(android.R.string.cancel,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int id){
      dismiss();
    }
  }
);
  return alert.show();
}