Program: 165206
Project: 165206
Buggy source:
private void updateSummary(String key,boolean changing){
switch (key) {
case Preferences.PREF_UPDATE_INTERVAL:
    updateIntervalSeekBar.setMax(Preferences.UPDATE_INTERVAL_VALUES.length - 1);
  int seekBarPosition=updateIntervalSeekBar.getValue();
updateIntervalSeekBar.setSummary(UPDATE_INTERVAL_NAMES[seekBarPosition]);
break;
case Preferences.PREF_OVER_WIFI:
overWifiSeekBar.setMax(Preferences.OVER_NETWORK_ALWAYS);
setNetworkSeekBarSummary(overWifiSeekBar);
enableUpdateInverval();
break;
case Preferences.PREF_OVER_DATA:
overDataSeekBar.setMax(Preferences.OVER_NETWORK_ALWAYS);
setNetworkSeekBarSummary(overDataSeekBar);
enableUpdateInverval();
break;
case Preferences.PREF_UPDATE_NOTIFICATION_ENABLED:
checkSummary(key,R.string.notify_on);
break;
case Preferences.PREF_THEME:
entrySummary(key);
if (changing) {
Activity activity=getActivity();
FDroidApp fdroidApp=(FDroidApp)activity.getApplication();
fdroidApp.reloadTheme();
fdroidApp.applyTheme(activity);
FDroidApp.forceChangeTheme(activity);
}
break;
case Preferences.PREF_SHOW_INCOMPAT_VERSIONS:
checkSummary(key,R.string.show_incompat_versions_on);
break;
case Preferences.PREF_SHOW_ROOT_APPS:
checkSummary(key,R.string.show_root_apps_on);
break;
case Preferences.PREF_SHOW_ANTI_FEATURE_APPS:
checkSummary(key,R.string.show_anti_feature_apps_on);
break;
case Preferences.PREF_FORCE_TOUCH_APPS:
checkSummary(key,R.string.force_touch_apps_on);
break;
case Preferences.PREF_LOCAL_REPO_NAME:
textSummary(key,R.string.local_repo_name_summary);
break;
case Preferences.PREF_LOCAL_REPO_HTTPS:
checkSummary(key,R.string.local_repo_https_on);
break;
case Preferences.PREF_LANGUAGE:
entrySummary(key);
if (changing) {
Activity activity=getActivity();
Languages.setLanguage(activity);
RepoProvider.Helper.clearEtags(getActivity());
UpdateService.updateNow(getActivity());
Languages.forceChangeLanguage(activity);
}
break;
case Preferences.PREF_KEEP_CACHE_TIME:
entrySummary(key);
if (changing && currentKeepCacheTime != Preferences.get().getKeepCacheTime()) {
CleanCacheService.schedule(getActivity());
}
break;
case Preferences.PREF_EXPERT:
checkSummary(key,R.string.expert_on);
boolean isExpertMode=Preferences.get().expertMode();
for (int i=0; i < otherPrefGroup.getPreferenceCount(); i++) {
Preference pref=otherPrefGroup.getPreference(i);
if (TextUtils.equals(Preferences.PREF_EXPERT,pref.getDependency())) {
pref.setVisible(isExpertMode);
}
}
if (changing) {
RecyclerView recyclerView=getListView();
recyclerView.smoothScrollToPosition(recyclerView.getAdapter().getItemCount() - 1);
}
break;
case Preferences.PREF_PRIVILEGED_INSTALLER:
final CheckBoxPreference pref=(CheckBoxPreference)findPreference(Preferences.PREF_PRIVILEGED_INSTALLER);
if (pref != null) {
checkSummary(key,R.string.system_installer_on);
}
break;
case Preferences.PREF_ENABLE_PROXY:
SwitchPreference checkPref=(SwitchPreference)findPreference(key);
checkPref.setSummary(R.string.enable_proxy_summary);
break;
case Preferences.PREF_PROXY_HOST:
EditTextPreference textPref=(EditTextPreference)findPreference(key);
String text=Preferences.get().getProxyHost();
if (TextUtils.isEmpty(text) || text.equals(Preferences.DEFAULT_PROXY_HOST)) {
textPref.setSummary(R.string.proxy_host_summary);
}
 else {
textPref.setSummary(text);
}
break;
case Preferences.PREF_PROXY_PORT:
EditTextPreference textPref2=(EditTextPreference)findPreference(key);
int port=Preferences.get().getProxyPort();
if (port == Preferences.DEFAULT_PROXY_PORT) {
textPref2.setSummary(R.string.proxy_port_summary);
}
 else {
textPref2.setSummary(String.valueOf(port));
}
break;
case Preferences.PREF_KEEP_INSTALL_HISTORY:
CheckBoxPreference p=(CheckBoxPreference)findPreference(key);
Preference installHistory=findPreference("String_Node_Str");
if (p.isChecked()) {
InstallHistoryService.register(getActivity());
installHistory.setVisible(true);
}
 else {
InstallHistoryService.unregister(getActivity());
installHistory.setVisible(false);
}
break;
}
}

Fixed version (ground truth):
private void updateSummary(String key,boolean changing){
switch (key) {
case Preferences.PREF_UPDATE_INTERVAL:
    updateIntervalSeekBar.setMax(Preferences.UPDATE_INTERVAL_VALUES.length - 1);
  int seekBarPosition=updateIntervalSeekBar.getValue();
updateIntervalSeekBar.setSummary(UPDATE_INTERVAL_NAMES[seekBarPosition]);
break;
case Preferences.PREF_OVER_WIFI:
overWifiSeekBar.setMax(Preferences.OVER_NETWORK_ALWAYS);
setNetworkSeekBarSummary(overWifiSeekBar);
enableUpdateInverval();
break;
case Preferences.PREF_OVER_DATA:
overDataSeekBar.setMax(Preferences.OVER_NETWORK_ALWAYS);
setNetworkSeekBarSummary(overDataSeekBar);
enableUpdateInverval();
break;
case Preferences.PREF_UPDATE_NOTIFICATION_ENABLED:
checkSummary(key,R.string.notify_on);
break;
case Preferences.PREF_THEME:
entrySummary(key);
if (changing) {
Activity activity=getActivity();
FDroidApp fdroidApp=(FDroidApp)activity.getApplication();
fdroidApp.reloadTheme();
fdroidApp.applyTheme(activity);
FDroidApp.forceChangeTheme(activity);
}
break;
case Preferences.PREF_SHOW_INCOMPAT_VERSIONS:
checkSummary(key,R.string.show_incompat_versions_on);
break;
case Preferences.PREF_SHOW_ROOT_APPS:
checkSummary(key,R.string.show_root_apps_on);
break;
case Preferences.PREF_SHOW_ANTI_FEATURE_APPS:
checkSummary(key,R.string.show_anti_feature_apps_on);
break;
case Preferences.PREF_FORCE_TOUCH_APPS:
checkSummary(key,R.string.force_touch_apps_on);
break;
case Preferences.PREF_LOCAL_REPO_NAME:
textSummary(key,R.string.local_repo_name_summary);
break;
case Preferences.PREF_LOCAL_REPO_HTTPS:
checkSummary(key,R.string.local_repo_https_on);
break;
case Preferences.PREF_LANGUAGE:
entrySummary(key);
if (changing) {
Activity activity=getActivity();
Languages.setLanguage(activity);
RepoProvider.Helper.clearEtags(getActivity());
UpdateService.updateNow(getActivity());
Languages.forceChangeLanguage(activity);
}
break;
case Preferences.PREF_KEEP_CACHE_TIME:
entrySummary(key);
if (changing && currentKeepCacheTime != Preferences.get().getKeepCacheTime()) {
CleanCacheService.schedule(getActivity());
}
break;
case Preferences.PREF_EXPERT:
checkSummary(key,R.string.expert_on);
boolean isExpertMode=Preferences.get().expertMode();
for (int i=0; i < otherPrefGroup.getPreferenceCount(); i++) {
Preference pref=otherPrefGroup.getPreference(i);
if (TextUtils.equals(Preferences.PREF_EXPERT,pref.getDependency())) {
pref.setVisible(isExpertMode);
}
}
if (changing) {
RecyclerView recyclerView=getListView();
recyclerView.smoothScrollToPosition(recyclerView.getAdapter().getItemCount() - 1);
}
break;
case Preferences.PREF_PRIVILEGED_INSTALLER:
final CheckBoxPreference pref=(CheckBoxPreference)findPreference(Preferences.PREF_PRIVILEGED_INSTALLER);
if (pref != null) {
checkSummary(key,R.string.system_installer_on);
}
break;
case Preferences.PREF_ENABLE_PROXY:
SwitchPreference checkPref=(SwitchPreference)findPreference(key);
checkPref.setSummary(R.string.enable_proxy_summary);
break;
case Preferences.PREF_PROXY_HOST:
EditTextPreference textPref=(EditTextPreference)findPreference(key);
String text=Preferences.get().getProxyHost();
if (TextUtils.isEmpty(text) || text.equals(Preferences.DEFAULT_PROXY_HOST)) {
textPref.setSummary(R.string.proxy_host_summary);
}
 else {
textPref.setSummary(text);
}
break;
case Preferences.PREF_PROXY_PORT:
EditTextPreference textPref2=(EditTextPreference)findPreference(key);
int port=Preferences.get().getProxyPort();
if (port == Preferences.DEFAULT_PROXY_PORT) {
textPref2.setSummary(R.string.proxy_port_summary);
}
 else {
textPref2.setSummary(String.valueOf(port));
}
break;
case Preferences.PREF_KEEP_INSTALL_HISTORY:
if (keepInstallHistoryPref.isChecked()) {
InstallHistoryService.register(getActivity());
installHistoryPref.setVisible(true);
}
 else {
InstallHistoryService.unregister(getActivity());
installHistoryPref.setVisible(false);
}
break;
}
}