Program: 34022
Project: 34022
Buggy source:
private void initConnectCameraUI(){
  mPublicIpEditText=(PortCheckEditText)findViewById(R.id.external_ip_float_edit_text);
  mHttpEditText=(PortCheckEditText)findViewById(R.id.http_float_edit_text);
  mRtspEditText=(PortCheckEditText)findViewById(R.id.rtsp_float_edit_text);
  mHttpStatusText=(TextView)findViewById(R.id.port_status_text_http);
  mRtspStatusText=(TextView)findViewById(R.id.port_status_text_rtsp);
  mHttpProgressBar=(ProgressBar)findViewById(R.id.progress_bar_http);
  mRtspProgressBar=(ProgressBar)findViewById(R.id.progress_bar_rtsp);
  mConnectExplainView=(ExplanationView)findViewById(R.id.explanation_view_layout);
  mAuthCheckBox=(CheckBox)findViewById(R.id.auth_check_box);
  mAuthLayout=(LinearLayout)findViewById(R.id.auth_layout);
  TextView requiredAuthText=(TextView)findViewById(R.id.required_auth_text);
  mCamUsernameEditText=(EditText)findViewById(R.id.cam_username_float_edit_text);
  mCamPasswordEditText=(EditText)findViewById(R.id.cam_password_float_edit_text);
  mCheckSnapshotButton=(Button)findViewById(R.id.check_snapshot_button);
  mConnectCameraNextButton=(Button)findViewById(R.id.connect_camera_next_button);
  TextView liveSupportLink=(TextView)findViewById(R.id.live_support_text_link);
  ImageView editModelImageButton=(ImageView)findViewById(R.id.edit_model_image_view);
  mSelectedModelTextView=(TextView)findViewById(R.id.selected_model_text);
  ImageView clearHostImageButton=(ImageView)findViewById(R.id.clear_host_image_button);
  clearHostImageButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mPublicIpEditText.setText("String_Node_Str");
    }
  }
);
  editModelImageButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      showModelSelectorView();
    }
  }
);
  liveSupportLink.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      Intercom.client().displayConversationsList();
    }
  }
);
  mConnectCameraNextButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      showCameraNameView();
    }
  }
);
  mCheckSnapshotButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      if (mValidateHostInput.passed()) {
        final String username=mCamUsernameEditText.getText().toString();
        final String password=mCamPasswordEditText.getText().toString();
        final String externalHost=mPublicIpEditText.getText().toString();
        final String externalHttp=mHttpEditText.getText().toString();
        String jpgUrl="String_Node_Str";
        if (mSelectedModel != null) {
          jpgUrl=AddEditCameraActivity.buildUrlEndingWithSlash(mSelectedModel.getDefaultJpgUrl());
        }
        String externalUrl=getString(R.string.prefix_http) + externalHost + "String_Node_Str"+ externalHttp;
        new TestSnapshotTask(externalUrl,jpgUrl,username,password,AddCameraActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      }
    }
  }
);
  View.OnFocusChangeListener showAuthTextListener=new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View v,    boolean hasFocus){
      showAuthExplanation();
    }
  }
;
  mCamUsernameEditText.setOnFocusChangeListener(showAuthTextListener);
  mCamPasswordEditText.setOnFocusChangeListener(showAuthTextListener);
  mAuthCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      onAuthCheckedChange(isChecked);
    }
  }
);
  requiredAuthText.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mAuthCheckBox.setChecked(!mAuthCheckBox.isChecked());
      onAuthCheckedChange(mAuthCheckBox.isChecked());
    }
  }
);
  mHttpEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View view,    boolean hasFocus){
      if (hasFocus) {
        mHttpEditText.hideStatusViewsOnTextChange(mHttpStatusText);
        updateMessage(mConnectExplainView,0,R.string.connect_camera_http_message);
      }
 else {
        checkPort(PortCheckTask.PortType.HTTP);
      }
    }
  }
);
  mRtspEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View v,    boolean hasFocus){
      if (hasFocus) {
        mRtspEditText.hideStatusViewsOnTextChange(mRtspStatusText);
        updateMessage(mConnectExplainView,0,R.string.connect_camera_rtsp_message);
      }
 else {
        checkPort(PortCheckTask.PortType.RTSP);
      }
    }
  }
);
  mPublicIpEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View v,    boolean hasFocus){
      if (hasFocus) {
        mPublicIpEditText.hideStatusViewsOnTextChange(mHttpStatusText,mRtspStatusText);
        updateMessage(mConnectExplainView,0,R.string.connect_camera_ip_message);
      }
 else {
        checkPort(PortCheckTask.PortType.HTTP);
        checkPort(PortCheckTask.PortType.RTSP);
      }
    }
  }
);
  mValidateHostInput=new ValidateHostInput(mPublicIpEditText,mHttpEditText,mRtspEditText){
    @Override public void onHostEmpty(){
      mPublicIpEditText.requestFocus();
      CustomToast.showInCenter(AddCameraActivity.this,getString(R.string.host_required));
    }
    @Override public void onHttpEmpty(){
      mHttpEditText.requestFocus();
      CustomToast.showInCenter(AddCameraActivity.this,getString(R.string.external_http_required));
    }
    @Override public void onInvalidHttpPort(){
      mHttpEditText.requestFocus();
      CustomToast.showInCenter(AddCameraActivity.this,getString(R.string.msg_port_range_error));
    }
    @Override public void onInvalidRtspPort(){
      mRtspEditText.requestFocus();
      CustomToast.showInCenter(AddCameraActivity.this,getString(R.string.msg_port_range_error));
    }
  }
;
}

Fixed version (ground truth):
private void initConnectCameraUI(){
  mPublicIpEditText=(PortCheckEditText)findViewById(R.id.external_ip_float_edit_text);
  mHttpEditText=(PortCheckEditText)findViewById(R.id.http_float_edit_text);
  mRtspEditText=(PortCheckEditText)findViewById(R.id.rtsp_float_edit_text);
  mHttpStatusText=(TextView)findViewById(R.id.port_status_text_http);
  mRtspStatusText=(TextView)findViewById(R.id.port_status_text_rtsp);
  mHttpProgressBar=(ProgressBar)findViewById(R.id.progress_bar_http);
  mRtspProgressBar=(ProgressBar)findViewById(R.id.progress_bar_rtsp);
  mConnectExplainView=(ExplanationView)findViewById(R.id.explanation_view_layout);
  mAuthCheckBox=(CheckBox)findViewById(R.id.auth_check_box);
  mAuthLayout=(LinearLayout)findViewById(R.id.auth_layout);
  TextView requiredAuthText=(TextView)findViewById(R.id.required_auth_text);
  mCamUsernameEditText=(EditText)findViewById(R.id.cam_username_float_edit_text);
  mCamPasswordEditText=(EditText)findViewById(R.id.cam_password_float_edit_text);
  mCheckSnapshotButton=(Button)findViewById(R.id.check_snapshot_button);
  TextView liveSupportLink=(TextView)findViewById(R.id.live_support_text_link);
  ImageView editModelImageButton=(ImageView)findViewById(R.id.edit_model_image_view);
  mSelectedModelTextView=(TextView)findViewById(R.id.selected_model_text);
  ImageView clearHostImageButton=(ImageView)findViewById(R.id.clear_host_image_button);
  mButtonIndicatorLayout=(RelativeLayout)findViewById(R.id.snapshot_button_indicator_layout);
  clearHostImageButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mPublicIpEditText.requestFocus();
      mPublicIpEditText.setText("String_Node_Str");
    }
  }
);
  editModelImageButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      showModelSelectorView();
    }
  }
);
  liveSupportLink.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      Intercom.client().displayConversationsList();
    }
  }
);
  mCheckSnapshotButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      if (mValidateHostInput.passed()) {
        final String username=mCamUsernameEditText.getText().toString();
        final String password=mCamPasswordEditText.getText().toString();
        final String externalHost=mPublicIpEditText.getText().toString();
        final String externalHttp=mHttpEditText.getText().toString();
        String jpgUrl="String_Node_Str";
        if (mSelectedModel != null) {
          jpgUrl=AddEditCameraActivity.buildUrlEndingWithSlash(mSelectedModel.getDefaultJpgUrl());
        }
        String externalUrl=getString(R.string.prefix_http) + externalHost + "String_Node_Str"+ externalHttp;
        new TestSnapshotTask(externalUrl,jpgUrl,username,password,AddCameraActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      }
    }
  }
);
  View.OnFocusChangeListener showAuthTextListener=new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View v,    boolean hasFocus){
      showAuthExplanation();
    }
  }
;
  mCamUsernameEditText.setOnFocusChangeListener(showAuthTextListener);
  mCamPasswordEditText.setOnFocusChangeListener(showAuthTextListener);
  mAuthCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      onAuthCheckedChange(isChecked);
    }
  }
);
  requiredAuthText.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mAuthCheckBox.setChecked(!mAuthCheckBox.isChecked());
      onAuthCheckedChange(mAuthCheckBox.isChecked());
    }
  }
);
  mHttpEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View view,    boolean hasFocus){
      if (hasFocus) {
        mHttpEditText.hideStatusViewsOnTextChange(mHttpStatusText);
        updateMessage(mConnectExplainView,0,R.string.connect_camera_http_message);
      }
 else {
        checkPort(PortCheckTask.PortType.HTTP);
      }
    }
  }
);
  mRtspEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View v,    boolean hasFocus){
      if (hasFocus) {
        mRtspEditText.hideStatusViewsOnTextChange(mRtspStatusText);
        updateMessage(mConnectExplainView,0,R.string.connect_camera_rtsp_message);
      }
 else {
        checkPort(PortCheckTask.PortType.RTSP);
      }
    }
  }
);
  mPublicIpEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View v,    boolean hasFocus){
      if (hasFocus) {
        mPublicIpEditText.hideStatusViewsOnTextChange(mHttpStatusText,mRtspStatusText);
        updateMessage(mConnectExplainView,0,R.string.connect_camera_ip_message);
      }
 else {
        checkPort(PortCheckTask.PortType.HTTP);
        checkPort(PortCheckTask.PortType.RTSP);
      }
    }
  }
);
  mValidateHostInput=new ValidateHostInput(mPublicIpEditText,mHttpEditText,mRtspEditText){
    @Override public void onHostEmpty(){
      mPublicIpEditText.requestFocus();
      CustomToast.showInCenter(AddCameraActivity.this,getString(R.string.host_required));
    }
    @Override public void onHttpEmpty(){
      mHttpEditText.requestFocus();
      CustomToast.showInCenter(AddCameraActivity.this,getString(R.string.external_http_required));
    }
    @Override public void onInvalidHttpPort(){
      mHttpEditText.requestFocus();
      CustomToast.showInCenter(AddCameraActivity.this,getString(R.string.msg_port_range_error));
    }
    @Override public void onInvalidRtspPort(){
      mRtspEditText.requestFocus();
      CustomToast.showInCenter(AddCameraActivity.this,getString(R.string.msg_port_range_error));
    }
  }
;
}