Program: 19186
Project: 19186
Buggy source:
protected void preparePreferences(){
  final EditTextPreference filterDistancePreference=findPreference("String_Node_Str",EditTextPreference.class);
  final EditText filterDistanceEditText=filterDistancePreference.getEditText();
  filterDistanceEditText.setKeyListener(DigitsKeyListener.getInstance(false,true));
  prefs=PreferenceManager.getDefaultSharedPreferences(this);
  Editor edit=prefs.edit();
  edit.remove("String_Node_Str");
  edit.commit();
  boolean imperialUnits=prefs.getBoolean("String_Node_Str",false);
  final CheckBoxPreference imperialUnitsPreference=findPreference("String_Node_Str",CheckBoxPreference.class);
  imperialUnitsPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      float distance=Float.parseFloat(filterDistancePreference.getText());
      if (((Boolean)newValue)) {
        filterDistancePreference.setText(Float.toString(distance / 1.609344F));
        filterDistancePreference.setSummary(preparePreferenceSummary(Float.toString(distance / 1.609344F) + UNIT_MILES,R.string.pref_distance_summary_miles));
        filterDistancePreference.setDialogMessage(R.string.pref_distance_summary_miles);
      }
 else {
        filterDistancePreference.setText(Float.toString(distance * 1.609344F));
        filterDistancePreference.setSummary(preparePreferenceSummary(Float.toString(distance * 1.609344F) + UNIT_KM,R.string.pref_distance_summary_km));
        filterDistancePreference.setDialogMessage(R.string.pref_distance_summary_km);
      }
      return true;
    }
  }
);
  if (!imperialUnits) {
    filterDistancePreference.setSummary(preparePreferenceSummary(filterDistancePreference.getText() + UNIT_KM,R.string.pref_distance_summary_km));
  }
 else {
    filterDistancePreference.setDialogMessage(R.string.pref_distance_summary_miles);
    filterDistancePreference.setSummary(preparePreferenceSummary(filterDistancePreference.getText() + UNIT_MILES,R.string.pref_distance_summary_miles));
  }
  final SeekBarPreference filterCountOfCachesPreference=findPreference("String_Node_Str",SeekBarPreference.class);
  filterCountOfCachesPreference.setSummary(preparePreferenceSummary(String.valueOf(filterCountOfCachesPreference.getProgress()),R.string.pref_count_of_caches_summary));
  final SeekBarPreference downloadingCountOfLogsPreference=findPreference("String_Node_Str",SeekBarPreference.class);
  downloadingCountOfLogsPreference.setSummary(preparePreferenceSummary(String.valueOf(downloadingCountOfLogsPreference.getProgress()),R.string.pref_count_of_logs_summary));
  final SeekBarPreference downloadingCountOfTrackablesPreference=findPreference("String_Node_Str",SeekBarPreference.class);
  downloadingCountOfTrackablesPreference.setSummary(preparePreferenceSummary(String.valueOf(downloadingCountOfTrackablesPreference.getProgress()),R.string.pref_count_of_trackables_summary));
  final EditTextPreference usernamePreference=findPreference("String_Node_Str",EditTextPreference.class);
  usernamePreference.setSummary(prepareRequiredPreferenceSummary(usernamePreference.getText(),0,true));
  final EditTextPreference passwordPreference=findPreference("String_Node_Str",EditTextPreference.class);
  passwordPreference.setSummary(prepareRequiredPreferenceSummary(passwordPreference.getText(),0,false));
  final Preference websitePreference=findPreference("String_Node_Str",Preference.class);
  websitePreference.setIntent(new Intent(Intent.ACTION_VIEW,WEBSITE_URI));
  final Preference donatePaypalPreference=findPreference("String_Node_Str",Preference.class);
  donatePaypalPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener(){
    @Override public boolean onPreferenceClick(    Preference preference){
      donatePaypal();
      return true;
    }
  }
);
  final ListPreference difficultyMinPreference=findPreference("String_Node_Str",ListPreference.class);
  final ListPreference difficultyMaxPreference=findPreference("String_Node_Str",ListPreference.class);
  difficultyMinPreference.setSummary(prepareRatingSummary(difficultyMinPreference.getValue()));
  difficultyMinPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      float min=Float.parseFloat(difficultyMinPreference.getValue());
      float max=Float.parseFloat(difficultyMaxPreference.getValue());
      if (min > max) {
        difficultyMaxPreference.setValue(difficultyMinPreference.getValue());
      }
      return true;
    }
  }
);
  difficultyMaxPreference.setSummary(prepareRatingSummary(difficultyMaxPreference.getValue()));
  difficultyMaxPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      float min=Float.parseFloat(difficultyMinPreference.getValue());
      float max=Float.parseFloat(difficultyMaxPreference.getValue());
      if (min > max) {
        difficultyMinPreference.setValue(difficultyMaxPreference.getValue());
      }
      return true;
    }
  }
);
  final ListPreference terrainMinPreference=findPreference("String_Node_Str",ListPreference.class);
  final ListPreference terrainMaxPreference=findPreference("String_Node_Str",ListPreference.class);
  terrainMinPreference.setSummary(prepareRatingSummary(terrainMinPreference.getValue()));
  terrainMinPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      float min=Float.parseFloat(terrainMinPreference.getValue());
      float max=Float.parseFloat(terrainMaxPreference.getValue());
      if (min > max) {
        terrainMaxPreference.setValue(terrainMinPreference.getValue());
      }
      return true;
    }
  }
);
  terrainMaxPreference.setSummary(prepareRatingSummary(terrainMaxPreference.getValue()));
  terrainMaxPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      float min=Float.parseFloat(terrainMinPreference.getValue());
      float max=Float.parseFloat(terrainMaxPreference.getValue());
      if (min > max) {
        terrainMinPreference.setValue(terrainMaxPreference.getValue());
      }
      return true;
    }
  }
);
  final CheckBoxPreference simpleCacheDataPreference=findPreference("String_Node_Str",CheckBoxPreference.class);
  final ListPreference fullCacheDataOnShowPreference=findPreference("String_Node_Str",ListPreference.class);
  simpleCacheDataPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      fullCacheDataOnShowPreference.setEnabled((Boolean)newValue);
      return true;
    }
  }
);
  fullCacheDataOnShowPreference.setEnabled(simpleCacheDataPreference.isChecked());
  fullCacheDataOnShowPreference.setSummary(preparePreferenceSummary(fullCacheDataOnShowPreference.getEntry(),R.string.pref_download_on_show_summary));
  final Preference versionPreference=findPreference("String_Node_Str",Preference.class);
  versionPreference.setSummary(getVersion(this));
}

Fixed version (ground truth):
protected void preparePreferences(){
  final EditTextPreference filterDistancePreference=findPreference("String_Node_Str",EditTextPreference.class);
  final EditText filterDistanceEditText=filterDistancePreference.getEditText();
  filterDistanceEditText.setKeyListener(DigitsKeyListener.getInstance(false,true));
  prefs=PreferenceManager.getDefaultSharedPreferences(this);
  Editor edit=prefs.edit();
  edit.remove("String_Node_Str");
  edit.commit();
  boolean imperialUnits=prefs.getBoolean("String_Node_Str",false);
  final CheckBoxPreference imperialUnitsPreference=findPreference("String_Node_Str",CheckBoxPreference.class);
  imperialUnitsPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      float distance=Float.parseFloat(filterDistancePreference.getText());
      if (((Boolean)newValue)) {
        filterDistancePreference.setText(Float.toString(distance / 1.609344F));
        filterDistancePreference.setSummary(preparePreferenceSummary(Float.toString(distance / 1.609344F) + UNIT_MILES,R.string.pref_distance_summary_miles));
        filterDistancePreference.setDialogMessage(R.string.pref_distance_summary_miles);
      }
 else {
        filterDistancePreference.setText(Float.toString(distance * 1.609344F));
        filterDistancePreference.setSummary(preparePreferenceSummary(Float.toString(distance * 1.609344F) + UNIT_KM,R.string.pref_distance_summary_km));
        filterDistancePreference.setDialogMessage(R.string.pref_distance_summary_km);
      }
      return true;
    }
  }
);
  if (!imperialUnits) {
    filterDistancePreference.setSummary(preparePreferenceSummary(filterDistancePreference.getText() + UNIT_KM,R.string.pref_distance_summary_km));
  }
 else {
    filterDistancePreference.setDialogMessage(R.string.pref_distance_summary_miles);
    filterDistancePreference.setSummary(preparePreferenceSummary(filterDistancePreference.getText() + UNIT_MILES,R.string.pref_distance_summary_miles));
  }
  final SeekBarPreference filterCountOfCachesPreference=findPreference("String_Node_Str",SeekBarPreference.class);
  filterCountOfCachesPreference.setSummary(preparePreferenceSummary(String.valueOf(filterCountOfCachesPreference.getProgress()),R.string.pref_count_of_caches_summary));
  final SeekBarPreference downloadingCountOfLogsPreference=findPreference("String_Node_Str",SeekBarPreference.class);
  downloadingCountOfLogsPreference.setSummary(preparePreferenceSummary(String.valueOf(downloadingCountOfLogsPreference.getProgress()),R.string.pref_count_of_logs_summary));
  final SeekBarPreference downloadingCountOfTrackablesPreference=findPreference("String_Node_Str",SeekBarPreference.class);
  downloadingCountOfTrackablesPreference.setSummary(preparePreferenceSummary(String.valueOf(downloadingCountOfTrackablesPreference.getProgress()),R.string.pref_count_of_trackables_summary));
  final EditTextPreference usernamePreference=findPreference("String_Node_Str",EditTextPreference.class);
  usernamePreference.setSummary(prepareRequiredPreferenceSummary(usernamePreference.getText(),0,true));
  final EditTextPreference passwordPreference=findPreference("String_Node_Str",EditTextPreference.class);
  passwordPreference.setSummary(prepareRequiredPreferenceSummary(passwordPreference.getText(),0,false));
  final Preference websitePreference=findPreference("String_Node_Str",Preference.class);
  websitePreference.setIntent(new Intent(Intent.ACTION_VIEW,WEBSITE_URI));
  final Preference donatePaypalPreference=findPreference("String_Node_Str",Preference.class);
  donatePaypalPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener(){
    @Override public boolean onPreferenceClick(    Preference preference){
      donatePaypal();
      return true;
    }
  }
);
  final ListPreference difficultyMinPreference=findPreference("String_Node_Str",ListPreference.class);
  final ListPreference difficultyMaxPreference=findPreference("String_Node_Str",ListPreference.class);
  difficultyMinPreference.setSummary(prepareRatingSummary(difficultyMinPreference.getValue()));
  difficultyMinPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      float min=Float.parseFloat((String)newValue);
      float max=Float.parseFloat(difficultyMaxPreference.getValue());
      if (min > max) {
        difficultyMaxPreference.setValue((String)newValue);
        difficultyMaxPreference.setSummary(prepareRatingSummary((String)newValue));
      }
      return true;
    }
  }
);
  difficultyMaxPreference.setSummary(prepareRatingSummary(difficultyMaxPreference.getValue()));
  difficultyMaxPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      float min=Float.parseFloat(difficultyMinPreference.getValue());
      float max=Float.parseFloat((String)newValue);
      if (min > max) {
        difficultyMinPreference.setValue((String)newValue);
        difficultyMinPreference.setSummary(prepareRatingSummary((String)newValue));
      }
      return true;
    }
  }
);
  final ListPreference terrainMinPreference=findPreference("String_Node_Str",ListPreference.class);
  final ListPreference terrainMaxPreference=findPreference("String_Node_Str",ListPreference.class);
  terrainMinPreference.setSummary(prepareRatingSummary(terrainMinPreference.getValue()));
  terrainMinPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      float min=Float.parseFloat((String)newValue);
      float max=Float.parseFloat(terrainMaxPreference.getValue());
      if (min > max) {
        terrainMaxPreference.setValue((String)newValue);
        terrainMaxPreference.setSummary(prepareRatingSummary((String)newValue));
      }
      return true;
    }
  }
);
  terrainMaxPreference.setSummary(prepareRatingSummary(terrainMaxPreference.getValue()));
  terrainMaxPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      float min=Float.parseFloat(terrainMinPreference.getValue());
      float max=Float.parseFloat((String)newValue);
      if (min > max) {
        terrainMinPreference.setValue((String)newValue);
        terrainMinPreference.setSummary(prepareRatingSummary((String)newValue));
      }
      return true;
    }
  }
);
  final CheckBoxPreference simpleCacheDataPreference=findPreference("String_Node_Str",CheckBoxPreference.class);
  final ListPreference fullCacheDataOnShowPreference=findPreference("String_Node_Str",ListPreference.class);
  simpleCacheDataPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      fullCacheDataOnShowPreference.setEnabled((Boolean)newValue);
      return true;
    }
  }
);
  fullCacheDataOnShowPreference.setEnabled(simpleCacheDataPreference.isChecked());
  fullCacheDataOnShowPreference.setSummary(preparePreferenceSummary(fullCacheDataOnShowPreference.getEntry(),R.string.pref_download_on_show_summary));
  final Preference versionPreference=findPreference("String_Node_Str",Preference.class);
  versionPreference.setSummary(getVersion(this));
}