Program: 60254
Project: 60254
Buggy source:
public void displayLibraryElements(){
  if (libraryEntry != null) {
    mRemove.setVisibility(View.VISIBLE);
    mRemove.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        CustomDialog.Builder builder=new CustomDialog.Builder(AnimeDetailsActivity.this,R.string.title_remove,R.string.yes);
        builder.negativeText(R.string.no);
        builder.positiveColor(getResources().getColor(R.color.apptheme_primary));
        String contentText=getString(R.string.content_remove_are_you_sure);
        contentText=contentText.replace("String_Node_Str",anime.getCanonicalTitle());
        builder.content(contentText);
        CustomDialog dialog=builder.build();
        dialog.setClickListener(new CustomDialog.ClickListener(){
          @Override public void onConfirmClick(){
            new RemoveTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
          }
          @Override public void onCancelClick(){
          }
        }
);
        dialog.show();
      }
    }
);
    for (    Favorite fav : user.getFavorites())     if (fav.getItemId().equals(ANIME_ID))     mFavoritedHolder.setVisibility(View.VISIBLE);
    mLibraryHolder.setVisibility(View.VISIBLE);
    mLibraryHolder.setBackgroundDrawable(new ColorDrawable(vibrantColor));
    mEpisodes.setText(libraryEntry.getEpisodesWatched() + "String_Node_Str" + anime.getEpisodeCount());
    mRewatching.setChecked(libraryEntry.isRewatching());
    mRewatchedTimes.setText(libraryEntry.getNumberOfRewatches() + "String_Node_Str");
    mPrivate.setChecked(libraryEntry.isPrivate());
    Rating rating=libraryEntry.getRating();
    if (rating.isAdvanced()) {
      if (rating.getAdvancedRating() != null)       mRatingBar.setRating(Float.parseFloat(rating.getAdvancedRating()));
 else       mRatingBar.setRating(0);
      mRatingBar.setVisibility(View.VISIBLE);
      mRatingSimple.setVisibility(View.GONE);
    }
 else {
      if (rating.getSimpleRating() != null)       mRatingSimple.setText(rating.getSimpleRating());
 else       mRatingSimple.setText(Rating.RATING_SIMPLE_NEUTRAL);
      mRatingBar.setVisibility(View.GONE);
      mRatingSimple.setVisibility(View.VISIBLE);
    }
    newWatchStatus=libraryEntry.getStatus();
    newEpisodesWatched=libraryEntry.getEpisodesWatched();
    newIsRewatching=libraryEntry.isRewatching();
    newRewatchedTimes=libraryEntry.getNumberOfRewatches();
    newRating=libraryEntry.getRating().getAdvancedRating() != null ? libraryEntry.getRating().getAdvancedRating() : "String_Node_Str";
    ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(AnimeDetailsActivity.this,R.array.library_watch_status_items,R.layout.item_spinner_library_status);
    adapter.setDropDownViewResource(R.layout.item_spinner_item_library_status);
    mStatusSpinner.setAdapter(adapter);
    String watchStatus=libraryEntry.getStatus();
    if (watchStatus.equals("String_Node_Str"))     mStatusSpinner.setSelection(0);
    if (watchStatus.equals("String_Node_Str"))     mStatusSpinner.setSelection(1);
    if (watchStatus.equals("String_Node_Str"))     mStatusSpinner.setSelection(2);
    if (watchStatus.equals("String_Node_Str"))     mStatusSpinner.setSelection(3);
    if (watchStatus.equals("String_Node_Str"))     mStatusSpinner.setSelection(4);
    mEpisodesHolder.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        CustomDialog.Builder builder=new CustomDialog.Builder(AnimeDetailsActivity.this,R.string.content_episodes,R.string.ok);
        builder.negativeText(R.string.cancel);
        builder.positiveColor(getResources().getColor(R.color.apptheme_primary));
        CustomDialog dialog=builder.build();
        View dialogView=getLayoutInflater().inflate(R.layout.number_picker,null);
        final NumberPicker mNumberPicker=(NumberPicker)dialogView.findViewById(R.id.number_picker);
        dialog.setCustomView(dialogView);
        mNumberPicker.setMaxValue(anime.getEpisodeCount());
        mNumberPicker.setValue(newEpisodesWatched);
        mNumberPicker.setWrapSelectorWheel(false);
        dialog.setClickListener(new CustomDialog.ClickListener(){
          @Override public void onConfirmClick(){
            newEpisodesWatched=mNumberPicker.getValue();
            mEpisodes.setText(newEpisodesWatched + "String_Node_Str" + anime.getEpisodeCount());
            if (newEpisodesWatched == anime.getEpisodeCount())             mStatusSpinner.setSelection(2);
            updateUpdateButtonStatus(libraryEntry);
          }
          @Override public void onCancelClick(){
          }
        }
);
        dialog.show();
      }
    }
);
    mRewatching.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
      @Override public void onCheckedChanged(      CompoundButton compoundButton,      boolean isChecked){
        newIsRewatching=isChecked;
        updateUpdateButtonStatus(libraryEntry);
      }
    }
);
    mRewatchedTimesHolder.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        CustomDialog.Builder builder=new CustomDialog.Builder(AnimeDetailsActivity.this,R.string.content_rewatched,R.string.ok);
        builder.negativeText(R.string.cancel);
        builder.positiveColor(getResources().getColor(R.color.apptheme_primary));
        CustomDialog dialog=builder.build();
        View dialogView=getLayoutInflater().inflate(R.layout.number_picker,null);
        final NumberPicker mNumberPicker=(NumberPicker)dialogView.findViewById(R.id.number_picker);
        dialog.setCustomView(dialogView);
        mNumberPicker.setMaxValue(200);
        mNumberPicker.setValue(newRewatchedTimes);
        mNumberPicker.setWrapSelectorWheel(false);
        dialog.setClickListener(new CustomDialog.ClickListener(){
          @Override public void onConfirmClick(){
            newRewatchedTimes=mNumberPicker.getValue();
            mRewatchedTimes.setText(newRewatchedTimes + "String_Node_Str");
            updateUpdateButtonStatus(libraryEntry);
          }
          @Override public void onCancelClick(){
          }
        }
);
        dialog.show();
      }
    }
);
    mPrivate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
      @Override public void onCheckedChanged(      CompoundButton compoundButton,      boolean b){
      }
    }
);
    mStatusSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
      @Override public void onItemSelected(      AdapterView<?> adapterView,      View view,      int position,      long l){
switch (position) {
case 0:
          newWatchStatus="String_Node_Str";
        break;
case 1:
      newWatchStatus="String_Node_Str";
    break;
case 2:
  newWatchStatus="String_Node_Str";
break;
case 3:
newWatchStatus="String_Node_Str";
break;
case 4:
newWatchStatus="String_Node_Str";
break;
}
updateUpdateButtonStatus(libraryEntry);
}
@Override public void onNothingSelected(AdapterView<?> adapterView){
}
}
);
mRatingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener(){
@Override public void onRatingChanged(RatingBar ratingBar,float rating,boolean fromUser){
newRating=rating + "String_Node_Str";
updateUpdateButtonStatus(libraryEntry);
}
}
);
mRatingSimple.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View view){
String rating=mRatingSimple.getText().toString();
if (rating.equals(Rating.RATING_SIMPLE_POSITIVE)) {
mRatingSimple.setText(Rating.RATING_SIMPLE_NEGATIVE);
newRating="String_Node_Str";
}
if (rating.equals(Rating.RATING_SIMPLE_NEGATIVE)) {
mRatingSimple.setText(Rating.RATING_SIMPLE_NEUTRAL);
newRating="String_Node_Str";
}
if (rating.equals(Rating.RATING_SIMPLE_NEUTRAL)) {
mRatingSimple.setText(Rating.RATING_SIMPLE_POSITIVE);
newRating="String_Node_Str";
}
updateUpdateButtonStatus(libraryEntry);
}
}
);
mAddToLibrary.setText(R.string.content_update);
mAddToLibrary.setEnabled(false);
mAddToLibrary.setOnClickListener(new OnLibraryUpdateClickListener());
}
 else {
mRemove.setVisibility(View.GONE);
mLibraryHolder.setVisibility(View.GONE);
}
}

Fixed version (ground truth):
public void displayLibraryElements(){
  if (libraryEntry != null) {
    mRemove.setVisibility(View.VISIBLE);
    mRemove.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        CustomDialog.Builder builder=new CustomDialog.Builder(AnimeDetailsActivity.this,R.string.title_remove,R.string.yes);
        builder.negativeText(R.string.no);
        builder.positiveColor(getResources().getColor(R.color.apptheme_primary));
        String contentText=getString(R.string.content_remove_are_you_sure);
        contentText=contentText.replace("String_Node_Str",anime.getCanonicalTitle());
        builder.content(contentText);
        CustomDialog dialog=builder.build();
        dialog.setClickListener(new CustomDialog.ClickListener(){
          @Override public void onConfirmClick(){
            new RemoveTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
          }
          @Override public void onCancelClick(){
          }
        }
);
        dialog.show();
      }
    }
);
    for (    Favorite fav : user.getFavorites())     if (fav.getItemId().equals(ANIME_ID))     mFavoritedHolder.setVisibility(View.VISIBLE);
    mLibraryHolder.setVisibility(View.VISIBLE);
    mLibraryHolder.setBackgroundDrawable(new ColorDrawable(vibrantColor));
    mEpisodes.setText(libraryEntry.getEpisodesWatched() + "String_Node_Str" + anime.getEpisodeCount());
    mRewatching.setChecked(libraryEntry.isRewatching());
    mRewatchedTimes.setText(libraryEntry.getNumberOfRewatches() + "String_Node_Str");
    mPrivate.setChecked(libraryEntry.isPrivate());
    Rating rating=libraryEntry.getRating();
    if (rating.isAdvanced()) {
      if (rating.getAdvancedRating() != null)       mRatingBar.setRating(Float.parseFloat(rating.getAdvancedRating()));
 else       mRatingBar.setRating(0);
      mRatingBar.setVisibility(View.VISIBLE);
      mRatingSimple.setVisibility(View.GONE);
    }
 else {
      if (rating.getSimpleRating() != null)       mRatingSimple.setText(rating.getSimpleRating());
 else       mRatingSimple.setText(Rating.RATING_SIMPLE_NEUTRAL);
      mRatingBar.setVisibility(View.GONE);
      mRatingSimple.setVisibility(View.VISIBLE);
    }
    newWatchStatus=libraryEntry.getStatus();
    newEpisodesWatched=libraryEntry.getEpisodesWatched();
    newIsRewatching=libraryEntry.isRewatching();
    newRewatchedTimes=libraryEntry.getNumberOfRewatches();
    newRating=libraryEntry.getRating().getAdvancedRating() != null ? libraryEntry.getRating().getAdvancedRating() : "String_Node_Str";
    ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(AnimeDetailsActivity.this,R.array.library_watch_status_items,R.layout.item_spinner_library_status);
    adapter.setDropDownViewResource(R.layout.item_spinner_item_library_status);
    mStatusSpinner.setAdapter(adapter);
    String watchStatus=libraryEntry.getStatus();
    if (watchStatus.equals("String_Node_Str"))     mStatusSpinner.setSelection(0);
    if (watchStatus.equals("String_Node_Str"))     mStatusSpinner.setSelection(1);
    if (watchStatus.equals("String_Node_Str"))     mStatusSpinner.setSelection(2);
    if (watchStatus.equals("String_Node_Str"))     mStatusSpinner.setSelection(3);
    if (watchStatus.equals("String_Node_Str"))     mStatusSpinner.setSelection(4);
    mEpisodesHolder.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        CustomDialog.Builder builder=new CustomDialog.Builder(AnimeDetailsActivity.this,R.string.content_episodes,R.string.ok);
        builder.negativeText(R.string.cancel);
        builder.positiveColor(getResources().getColor(R.color.apptheme_primary));
        CustomDialog dialog=builder.build();
        View dialogView=getLayoutInflater().inflate(R.layout.number_picker,null);
        final NumberPicker mNumberPicker=(NumberPicker)dialogView.findViewById(R.id.number_picker);
        dialog.setCustomView(dialogView);
        mNumberPicker.setMaxValue(anime.getEpisodeCount() != 0 ? anime.getEpisodeCount() : 1000);
        mNumberPicker.setValue(newEpisodesWatched);
        mNumberPicker.setWrapSelectorWheel(false);
        dialog.setClickListener(new CustomDialog.ClickListener(){
          @Override public void onConfirmClick(){
            newEpisodesWatched=mNumberPicker.getValue();
            mEpisodes.setText(newEpisodesWatched + "String_Node_Str" + anime.getEpisodeCount());
            if (newEpisodesWatched == anime.getEpisodeCount())             mStatusSpinner.setSelection(2);
            updateUpdateButtonStatus(libraryEntry);
          }
          @Override public void onCancelClick(){
          }
        }
);
        dialog.show();
      }
    }
);
    mRewatching.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
      @Override public void onCheckedChanged(      CompoundButton compoundButton,      boolean isChecked){
        newIsRewatching=isChecked;
        updateUpdateButtonStatus(libraryEntry);
      }
    }
);
    mRewatchedTimesHolder.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        CustomDialog.Builder builder=new CustomDialog.Builder(AnimeDetailsActivity.this,R.string.content_rewatched,R.string.ok);
        builder.negativeText(R.string.cancel);
        builder.positiveColor(getResources().getColor(R.color.apptheme_primary));
        CustomDialog dialog=builder.build();
        View dialogView=getLayoutInflater().inflate(R.layout.number_picker,null);
        final NumberPicker mNumberPicker=(NumberPicker)dialogView.findViewById(R.id.number_picker);
        dialog.setCustomView(dialogView);
        mNumberPicker.setMaxValue(200);
        mNumberPicker.setValue(newRewatchedTimes);
        mNumberPicker.setWrapSelectorWheel(false);
        dialog.setClickListener(new CustomDialog.ClickListener(){
          @Override public void onConfirmClick(){
            newRewatchedTimes=mNumberPicker.getValue();
            mRewatchedTimes.setText(newRewatchedTimes + "String_Node_Str");
            updateUpdateButtonStatus(libraryEntry);
          }
          @Override public void onCancelClick(){
          }
        }
);
        dialog.show();
      }
    }
);
    mPrivate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
      @Override public void onCheckedChanged(      CompoundButton compoundButton,      boolean b){
      }
    }
);
    mStatusSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
      @Override public void onItemSelected(      AdapterView<?> adapterView,      View view,      int position,      long l){
switch (position) {
case 0:
          newWatchStatus="String_Node_Str";
        break;
case 1:
      newWatchStatus="String_Node_Str";
    break;
case 2:
  newWatchStatus="String_Node_Str";
break;
case 3:
newWatchStatus="String_Node_Str";
break;
case 4:
newWatchStatus="String_Node_Str";
break;
}
updateUpdateButtonStatus(libraryEntry);
}
@Override public void onNothingSelected(AdapterView<?> adapterView){
}
}
);
mRatingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener(){
@Override public void onRatingChanged(RatingBar ratingBar,float rating,boolean fromUser){
newRating=rating + "String_Node_Str";
updateUpdateButtonStatus(libraryEntry);
}
}
);
mRatingSimple.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View view){
String rating=mRatingSimple.getText().toString();
if (rating.equals(Rating.RATING_SIMPLE_POSITIVE)) {
mRatingSimple.setText(Rating.RATING_SIMPLE_NEGATIVE);
newRating="String_Node_Str";
}
if (rating.equals(Rating.RATING_SIMPLE_NEGATIVE)) {
mRatingSimple.setText(Rating.RATING_SIMPLE_NEUTRAL);
newRating="String_Node_Str";
}
if (rating.equals(Rating.RATING_SIMPLE_NEUTRAL)) {
mRatingSimple.setText(Rating.RATING_SIMPLE_POSITIVE);
newRating="String_Node_Str";
}
updateUpdateButtonStatus(libraryEntry);
}
}
);
mAddToLibrary.setText(R.string.content_update);
mAddToLibrary.setEnabled(false);
mAddToLibrary.setOnClickListener(new OnLibraryUpdateClickListener());
}
 else {
mRemove.setVisibility(View.GONE);
mLibraryHolder.setVisibility(View.GONE);
}
}