Program: 34013
Project: 34013
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);
  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);
  mConnectFormLayout=(LinearLayout)findViewById(R.id.connect_form_layout);
  mSnapshotPathLayout=(LinearLayout)findViewById(R.id.snapshot_path_layout);
  mRtspPathLayout=(LinearLayout)findViewById(R.id.rtsp_path_layout);
  mSnapshotPathEditText=(EditText)findViewById(R.id.snapshot_path_float_edit_text);
  mRtspPathEditText=(EditText)findViewById(R.id.rtsp_path_float_edit_text);
  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) {
          if (!mSelectedModel.isUnknown()) {
            jpgUrl=AddEditCameraActivity.buildUrlEndingWithSlash(mSelectedModel.getDefaultJpgUrl());
          }
 else {
            final String jpgPath=mSnapshotPathEditText.getText().toString();
            jpgUrl=AddEditCameraActivity.buildUrlEndingWithSlash(jpgPath);
          }
        }
        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);
      }
    }
  }
);
  mSnapshotPathEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View v,    boolean hasFocus){
      if (hasFocus) {
        updateMessage(mConnectExplainView,0,R.string.connect_camera_snapshot_path_message);
      }
    }
  }
);
  mRtspPathEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View v,    boolean hasFocus){
      if (hasFocus) {
        updateMessage(mConnectExplainView,0,R.string.connect_camera_rtsp_path_message);
      }
    }
  }
);
  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);
  mConnectFormLayout=(LinearLayout)findViewById(R.id.connect_form_layout);
  mSnapshotPathLayout=(LinearLayout)findViewById(R.id.snapshot_path_layout);
  mRtspPathLayout=(LinearLayout)findViewById(R.id.rtsp_path_layout);
  mSnapshotPathEditText=(EditText)findViewById(R.id.snapshot_path_float_edit_text);
  mRtspPathEditText=(EditText)findViewById(R.id.rtsp_path_float_edit_text);
  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) {
          if (!mSelectedModel.isUnknown()) {
            jpgUrl=AddEditCameraActivity.buildUrlEndingWithSlash(mSelectedModel.getDefaultJpgUrl());
          }
 else {
            final String jpgPath=mSnapshotPathEditText.getText().toString();
            jpgUrl=AddEditCameraActivity.buildUrlEndingWithSlash(jpgPath);
          }
        }
        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);
      }
    }
  }
);
  mSnapshotPathEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View v,    boolean hasFocus){
      if (hasFocus) {
        updateMessage(mConnectExplainView,0,R.string.connect_camera_snapshot_path_message);
      }
    }
  }
);
  mRtspPathEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View v,    boolean hasFocus){
      if (hasFocus) {
        updateMessage(mConnectExplainView,0,R.string.connect_camera_rtsp_path_message);
      }
    }
  }
);
  mValidateHostInput=new ValidateHostInput(mPublicIpEditText,mHttpEditText,mRtspEditText){
    @Override public void onLocalIp(){
      mPublicIpEditText.requestFocus();
      showLocalIpWarning();
    }
    @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));
    }
  }
;
}