Program: 134570
Project: 134570
Buggy source:
public SwitchListenerFragment(){
  callbacks=new SwitchListenerTaskFragment.CallBacks(){
    @Override public void updateState(    ListenerState state,    SwitchListenerResult result){
      Log.d(getClass().getName(),"String_Node_Str" + state);
      proxyStartedTextView.setVisibility(View.GONE);
      handleError(result);
      if (state != null) {
switch (state) {
case STARTING:
          listenerSwitch.setEnabled(false);
        forceToggledWithoutListener(true);
      break;
case STARTED:
    listenerSwitch.setEnabled(true);
  forceToggledWithoutListener(true);
listenerStatus.setText(generateStatusStartedText());
String proxyUrl="String_Node_Str";
final DefaultSharedPreferencesHelper prefHelper=new DefaultSharedPreferencesHelper(getActivity());
if (prefHelper.isListenerNonLocalEnabled()) {
final WifiHelper wifiHelper=new WifiHelper(getActivity());
proxyUrl=wifiHelper.getWifiIpAddress() + "String_Node_Str";
}
proxyStartedTextView.setText(getString(R.string.switch_listener_proxy_started,proxyUrl));
proxyStartedTextView.setVisibility(View.VISIBLE);
break;
case START_FAILED:
listenerSwitch.setEnabled(true);
forceToggledWithoutListener(false);
listenerStatus.setText(R.string.switch_listener_status_start_failed);
break;
case STOPPING:
listenerSwitch.setEnabled(false);
forceToggledWithoutListener(false);
break;
case STOPPED:
listenerSwitch.setEnabled(true);
forceToggledWithoutListener(false);
listenerStatus.setText(R.string.switch_listener_status_stopped);
break;
case STOP_FAILED:
listenerSwitch.setEnabled(true);
forceToggledWithoutListener(true);
listenerStatus.setText(R.string.switch_listener_status_stop_failed);
break;
default :
}
}
 else {
listenerSwitch.setEnabled(true);
forceToggledWithoutListener(false);
listenerStatus.setText(R.string.switch_listener_status_stopped);
}
}
private void handleError(SwitchListenerResult result){
Log.d(getClass().getName(),"String_Node_Str");
if (result == null || result.isSuccess()) {
if (!missingRequirement) {
errorText.setVisibility(View.GONE);
showLogsButton.setVisibility(View.GONE);
}
}
 else if (result.getError() instanceof MissingRequirementException) {
final int resId=((MissingRequirementException)result.getError()).getRequirement().getErrorTextResId();
updateMissingRequirement(resId);
}
 else {
updateError(result.getError().getMessage(),result.getLogs());
}
}
}
;
}

Fixed version (ground truth):
public SwitchListenerFragment(){
  callbacks=new SwitchListenerTaskFragment.CallBacks(){
    @Override public void updateState(    ListenerState state,    SwitchListenerResult result){
      Log.d(getClass().getName(),"String_Node_Str" + state);
      proxyStartedTextView.setVisibility(View.GONE);
      handleError(result);
      if (state != null) {
switch (state) {
case STARTING:
          listenerSwitch.setEnabled(false);
        forceToggledWithoutListener(true);
      break;
case STARTED:
    listenerSwitch.setEnabled(true);
  forceToggledWithoutListener(true);
listenerStatus.setText(generateStatusStartedText());
String proxyUrl="String_Node_Str";
final DefaultSharedPreferencesHelper prefHelper=new DefaultSharedPreferencesHelper(getActivity());
if (prefHelper.isListenerNonLocalEnabled()) {
final WifiHelper wifiHelper=new WifiHelper(getActivity());
proxyUrl=wifiHelper.getWifiIpAddress() + "String_Node_Str";
}
proxyStartedTextView.setText(getString(R.string.switch_listener_proxy_started,proxyUrl));
proxyStartedTextView.setVisibility(View.VISIBLE);
break;
case START_FAILED:
listenerSwitch.setEnabled(true);
forceToggledWithoutListener(false);
listenerStatus.setText(R.string.switch_listener_status_start_failed);
break;
case STOPPING:
listenerSwitch.setEnabled(false);
forceToggledWithoutListener(false);
break;
case STOPPED:
listenerSwitch.setEnabled(true);
forceToggledWithoutListener(false);
listenerStatus.setText(R.string.switch_listener_status_stopped);
break;
case STOP_FAILED:
listenerSwitch.setEnabled(true);
forceToggledWithoutListener(true);
listenerStatus.setText(R.string.switch_listener_status_stop_failed);
break;
default :
}
}
 else {
listenerSwitch.setEnabled(true);
forceToggledWithoutListener(false);
listenerStatus.setText(R.string.switch_listener_status_stopped);
}
}
private void handleError(SwitchListenerResult result){
Log.d(getClass().getName(),"String_Node_Str");
if (result == null || result.isSuccess()) {
if (!missingRequirement) {
errorText.setVisibility(View.GONE);
showLogsButton.setVisibility(View.GONE);
}
}
 else if (result.getError() instanceof MissingRequirementException) {
final int resId=((MissingRequirementException)result.getError()).getRequirement().getErrorTextResId();
updateMissingRequirement(resId);
}
 else {
updateError(result.getError().getMessage(),result);
}
}
}
;
}