Program: 174196
Project: 174196
Buggy source:
void setListeners(){
  old_new_radiogr.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    RadioGroup radioGroup,    int checkedId){
switch (checkedId) {
case R.id.new_radiobtn:
        isNew=true;
      break;
case R.id.old_radiobtn:
    isNew=false;
  break;
}
}
}
);
mPriceEt.addTextChangedListener(new TextWatcher(){
boolean isEdiging;
@Override public void onTextChanged(CharSequence s,int start,int before,int count){
}
@Override public void beforeTextChanged(CharSequence s,int start,int count,int after){
}
@Override public void afterTextChanged(Editable s){
mPriceEt.removeTextChangedListener(this);
try {
String originalString=s.toString();
Long longval;
if (originalString.contains("String_Node_Str")) {
  originalString=originalString.replaceAll("String_Node_Str","String_Node_Str");
}
longval=Long.parseLong(originalString);
DecimalFormat formatter=(DecimalFormat)NumberFormat.getInstance(Locale.US);
formatter.applyPattern("String_Node_Str");
String formattedString=formatter.format(longval);
mPriceEt.setText(formattedString);
mPriceEt.setSelection(mPriceEt.getText().length());
}
 catch (NumberFormatException nfe) {
nfe.printStackTrace();
}
mPriceEt.addTextChangedListener(this);
}
}
);
mToolbarSendBtnTv.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
if (mTitleEt.getText().toString().equals("String_Node_Str")) {
Snackbari.showS(mTitleEt,"String_Node_Str");
return;
}
 else if (mPriceEt.getText().toString().equals("String_Node_Str")) {
Snackbari.showS(mTitleEt,"String_Node_Str" + "String_Node_Str");
return;
}
 else if (mDescriptionEt.getText().toString().equals("String_Node_Str")) {
Snackbari.showS(mTitleEt,"String_Node_Str");
return;
}
 else if (category == null) {
Snackbari.showS(mTitleEt,"String_Node_Str");
return;
}
 else if (city == null) {
Snackbari.showS(mTitleEt,"String_Node_Str");
return;
}
 else if (myGift.giftImages.size() == 0) {
Snackbari.showS(mTitleEt,"String_Node_Str");
return;
}
Gift tempGift=new Gift(mDescriptionEt.getText().toString(),region != null ? (getPlaceNameById(city.id) + "String_Node_Str" + getPlaceNameById(region.id)) : getPlaceNameById(city.id),mTitleEt.getText().toString(),mPriceEt.getText().toString().replace("String_Node_Str","String_Node_Str"),category.categoryId,city.id,(region == null ? "String_Node_Str" : region.id),isNew,myGift.giftImages);
if (editVersion) {
tempGift.giftId=myGift.giftId;
(new ApiRequest(context,RegisterGiftActivity.this)).editGift(tempGift);
}
 else {
(new ApiRequest(context,RegisterGiftActivity.this)).registerGift(tempGift);
AppController.deleteSavedGift();
}
mToolbarSendBtnTv.setVisibility(View.INVISIBLE);
mSendProgressView.setVisibility(View.VISIBLE);
}
}
);
mChooseRegionBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View view){
FragmentManager fm=getSupportFragmentManager();
ChoosePlaceDialogFragment choosePlaceDialogFragment=ChoosePlaceDialogFragment.newInstance(city.id);
choosePlaceDialogFragment.show(fm,ChoosePlaceDialogFragment.class.getName());
}
}
);
mBackBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
if (!editVersion) {
saveMyGift();
Toasti.showS(getString(R.string.gift_info_saved));
}
onBackPressed();
}
}
);
mCancelBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
AppController.deleteSavedGift();
finish();
}
}
);
mSaveBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View view){
saveMyGift();
Snackbari.showS(mTitleEt,getString(R.string.gift_info_saved));
}
}
);
mChooseCategoryBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
FragmentManager fm=getSupportFragmentManager();
ChooseCategoryDialogFragment chooseCategoryDF=new ChooseCategoryDialogFragment();
chooseCategoryDF.show(fm,chooseCategoryDF.getClass().getName());
}
}
);
mChooseImageBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
startActivityForResult(getPickImageChooserIntent(),200);
}
}
);
mChooseCityBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View view){
FragmentManager fm=getSupportFragmentManager();
ChoosePlaceDialogFragment choosePlaceDialogFragment=new ChoosePlaceDialogFragment();
choosePlaceDialogFragment.show(fm,ChoosePlaceDialogFragment.class.getName());
}
}
);
}

Fixed version (ground truth):
void setListeners(){
  old_new_radiogr.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    RadioGroup radioGroup,    int checkedId){
switch (checkedId) {
case R.id.new_radiobtn:
        isNew=true;
      break;
case R.id.old_radiobtn:
    isNew=false;
  break;
}
}
}
);
mPriceEt.addTextChangedListener(new TextWatcher(){
boolean isEdiging;
@Override public void onTextChanged(CharSequence s,int start,int before,int count){
}
@Override public void beforeTextChanged(CharSequence s,int start,int count,int after){
}
@Override public void afterTextChanged(Editable s){
mPriceEt.removeTextChangedListener(this);
try {
String originalString=s.toString();
Long longval;
if (originalString.contains("String_Node_Str")) {
  originalString=originalString.replaceAll("String_Node_Str","String_Node_Str");
}
longval=Long.parseLong(originalString);
DecimalFormat formatter=(DecimalFormat)NumberFormat.getInstance(Locale.US);
formatter.applyPattern("String_Node_Str");
String formattedString=formatter.format(longval);
mPriceEt.setText(formattedString);
mPriceEt.setSelection(mPriceEt.getText().length());
}
 catch (NumberFormatException nfe) {
nfe.printStackTrace();
}
mPriceEt.addTextChangedListener(this);
}
}
);
mToolbarSendBtnTv.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
if (mTitleEt.getText().toString().equals("String_Node_Str")) {
Snackbari.showS(mTitleEt,"String_Node_Str");
return;
}
 else if (mPriceEt.getText().toString().equals("String_Node_Str")) {
Snackbari.showS(mTitleEt,"String_Node_Str" + "String_Node_Str");
return;
}
 else if (mDescriptionEt.getText().toString().equals("String_Node_Str")) {
Snackbari.showS(mTitleEt,"String_Node_Str");
return;
}
 else if (category == null) {
Snackbari.showS(mTitleEt,"String_Node_Str");
return;
}
 else if (city == null) {
Snackbari.showS(mTitleEt,"String_Node_Str");
return;
}
 else if (myGift.giftImages.size() == 0) {
Snackbari.showS(mTitleEt,"String_Node_Str");
return;
}
Gift tempGift=new Gift(mDescriptionEt.getText().toString(),region != null ? (getPlaceNameById(city.id) + "String_Node_Str" + getPlaceNameById(region.id)) : getPlaceNameById(city.id),mTitleEt.getText().toString(),mPriceEt.getText().toString().replace("String_Node_Str","String_Node_Str"),category.categoryId,city.id,(region == null ? "String_Node_Str" : region.id),isNew,myGift.giftImages);
if (editVersion) {
tempGift.giftId=myGift.giftId;
(new ApiRequest(context,RegisterGiftActivity.this)).editGift(tempGift);
}
 else {
(new ApiRequest(context,RegisterGiftActivity.this)).registerGift(tempGift);
AppController.deleteSavedGift();
}
mToolbarSendBtnTv.setVisibility(View.INVISIBLE);
mSendProgressView.setVisibility(View.VISIBLE);
}
}
);
mChooseRegionBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View view){
chooseRegion();
}
}
);
mBackBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
if (!editVersion) {
saveMyGift();
Toasti.showS(getString(R.string.gift_info_saved));
}
onBackPressed();
}
}
);
mCancelBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
AppController.deleteSavedGift();
finish();
}
}
);
mSaveBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View view){
saveMyGift();
Snackbari.showS(mTitleEt,getString(R.string.gift_info_saved));
}
}
);
mChooseCategoryBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
FragmentManager fm=getSupportFragmentManager();
ChooseCategoryDialogFragment chooseCategoryDF=new ChooseCategoryDialogFragment();
chooseCategoryDF.show(fm,chooseCategoryDF.getClass().getName());
}
}
);
mChooseImageBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
startActivityForResult(getPickImageChooserIntent(),200);
}
}
);
mChooseCityBtn.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View view){
FragmentManager fm=getSupportFragmentManager();
ChoosePlaceDialogFragment choosePlaceDialogFragment=new ChoosePlaceDialogFragment();
choosePlaceDialogFragment.show(fm,ChoosePlaceDialogFragment.class.getName());
}
}
);
}