Program: 40015
Project: 40015
Buggy source:
public void onClick(View v){
  v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
  SharedPreferences sharedPreferences=getActivity().getSharedPreferences("String_Node_Str",Context.MODE_PRIVATE);
switch (v.getId()) {
case R.id.fragment_signup_signup:
    String txtFirstName="String_Node_Str";
  String txtLastName="String_Node_Str";
String txtEmail="String_Node_Str";
String txtPass="String_Node_Str";
String txtOrg="String_Node_Str";
String txtPhone="String_Node_Str";
boolean validForm=true;
EditText signupFirstName=(EditText)getActivity().findViewById(R.id.fragment_signup_first_name);
EditText signupLastName=(EditText)getActivity().findViewById(R.id.fragment_signup_last_name);
EditText signupEmail=(EditText)getActivity().findViewById(R.id.fragment_signup_email_address);
EditText signupPassword=(EditText)getActivity().findViewById(R.id.fragment_signup_password);
EditText signupPasswordConfirm=(EditText)getActivity().findViewById(R.id.fragment_signup_password_confirm);
EditText signupOrganization=(EditText)getActivity().findViewById(R.id.fragment_signup_organization);
EditText signupPhone=(EditText)getActivity().findViewById(R.id.fragment_signup_phone_number);
txtOrg=signupOrganization.getText().toString();
txtPhone=signupPhone.getText().toString();
CheckBox signupPrivacyPolicy=(CheckBox)getActivity().findViewById(R.id.fragment_signup_privacy_policy_checkbox);
if (signupPassword.getText().length() == 0) {
signupPassword.setError("String_Node_Str");
signupPassword.requestFocus();
validForm=false;
}
 else if (!signupPassword.getText().equals(signupPasswordConfirm.getText())) {
signupPasswordConfirm.setError("String_Node_Str");
signupPasswordConfirm.requestFocus();
validForm=false;
}
 else {
txtPass=signupPassword.getText().toString();
}
if (signupEmail.getText().length() == 0) {
signupEmail.setError("String_Node_Str");
signupEmail.requestFocus();
validForm=false;
}
 else if (!android.util.Patterns.EMAIL_ADDRESS.matcher(signupEmail.getText()).matches()) {
signupEmail.setError("String_Node_Str");
signupEmail.requestFocus();
validForm=false;
}
 else {
txtEmail=signupEmail.getText().toString();
sharedPreferences.edit().putString(ValueHelper.USERNAME,txtEmail).commit();
}
if (signupLastName.getText().length() == 0) {
signupLastName.setError("String_Node_Str");
signupLastName.requestFocus();
validForm=false;
}
 else {
txtLastName=signupLastName.getText().toString();
}
if (signupFirstName.getText().length() == 0) {
signupFirstName.setError("String_Node_Str");
signupFirstName.requestFocus();
validForm=false;
}
 else {
txtFirstName=signupFirstName.getText().toString();
}
if (!signupPrivacyPolicy.isChecked()) {
signupPrivacyPolicy.setError("String_Node_Str");
signupPrivacyPolicy.requestFocus();
validForm=false;
}
if (validForm) {
InputMethodManager inputManager=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(signupEmail.getWindowToken(),0);
RegisterRequest registerRequest=new RegisterRequest();
registerRequest.setFirstName(txtFirstName);
registerRequest.setLastName(txtLastName);
registerRequest.setClientId(txtEmail);
registerRequest.setClientSecret(txtPass);
registerRequest.setOrganization(txtOrg);
registerRequest.setPhone(txtPhone);
MainActivity.progressDialog=new ProgressDialog(getActivity());
MainActivity.progressDialog.setCancelable(false);
MainActivity.progressDialog.setMessage(getActivity().getString(R.string.sign_up_in_progress));
MainActivity.progressDialog.show();
final String finalFirstName=txtFirstName;
final String finalLastName=txtLastName;
Call<TokenResponse> register=Api.instance().getApi().register(registerRequest);
register.enqueue(new Callback<TokenResponse>(){
@Override public void onResponse(Call<TokenResponse> call,Response<TokenResponse> response){
MainActivity.progressDialog.cancel();
if (response.isSuccessful()) {
SharedPreferences mSharedPreferences=getActivity().getSharedPreferences("String_Node_Str",Context.MODE_PRIVATE);
mSharedPreferences.edit().putString(ValueHelper.TOKEN,response.body().getToken()).commit();
Api.instance().setAuthToken(response.body().getToken());
((MainActivity)getActivity()).transitionToMapsFragment();
}
}
@Override public void onFailure(Call<TokenResponse> call,Throwable t){
MainActivity.progressDialog.cancel();
Toast.makeText(getActivity(),t.getMessage(),Toast.LENGTH_SHORT).show();
Timber.tag(TAG).e(t.getMessage());
}
}
);
}
break;
case R.id.fragment_signup_login_already_have_account:
sharedPreferences.edit().putBoolean(ValueHelper.SHOW_SIGNUP_FRAGMENT,false).commit();
sharedPreferences.edit().putBoolean(ValueHelper.SHOW_LOGIN_FRAGMENT,true).commit();
LoginFragment fragment=new LoginFragment();
Bundle bundle=getActivity().getIntent().getExtras();
fragment.setArguments(bundle);
FragmentTransaction fragmentTransaction1=getActivity().getSupportFragmentManager().beginTransaction();
fragmentTransaction1.replace(R.id.container_fragment,fragment).commit();
break;
}
}

Fixed version (ground truth):
public void onClick(View v){
  v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
  SharedPreferences sharedPreferences=getActivity().getSharedPreferences("String_Node_Str",Context.MODE_PRIVATE);
switch (v.getId()) {
case R.id.fragment_signup_signup:
    String txtFirstName="String_Node_Str";
  String txtLastName="String_Node_Str";
String txtEmail="String_Node_Str";
String txtPass="String_Node_Str";
String txtPassConfirm="String_Node_Str";
String txtOrg="String_Node_Str";
String txtPhone="String_Node_Str";
boolean validForm=true;
EditText signupFirstName=(EditText)getActivity().findViewById(R.id.fragment_signup_first_name);
EditText signupLastName=(EditText)getActivity().findViewById(R.id.fragment_signup_last_name);
EditText signupEmail=(EditText)getActivity().findViewById(R.id.fragment_signup_email_address);
EditText signupPassword=(EditText)getActivity().findViewById(R.id.fragment_signup_password);
EditText signupPasswordConfirm=(EditText)getActivity().findViewById(R.id.fragment_signup_password_confirm);
EditText signupOrganization=(EditText)getActivity().findViewById(R.id.fragment_signup_organization);
EditText signupPhone=(EditText)getActivity().findViewById(R.id.fragment_signup_phone_number);
txtOrg=signupOrganization.getText().toString();
txtPhone=signupPhone.getText().toString();
txtPass=signupPassword.getText().toString().trim();
txtPassConfirm=signupPasswordConfirm.getText().toString().trim();
CheckBox signupPrivacyPolicy=(CheckBox)getActivity().findViewById(R.id.fragment_signup_privacy_policy_checkbox);
if (signupPassword.getText().length() == 0) {
signupPassword.setError("String_Node_Str");
signupPassword.requestFocus();
validForm=false;
}
 else if (!txtPass.equals(txtPassConfirm)) {
signupPasswordConfirm.setError("String_Node_Str");
signupPasswordConfirm.requestFocus();
validForm=false;
}
 else {
txtPass=signupPassword.getText().toString();
}
if (signupEmail.getText().length() == 0) {
signupEmail.setError("String_Node_Str");
signupEmail.requestFocus();
validForm=false;
}
 else if (!android.util.Patterns.EMAIL_ADDRESS.matcher(signupEmail.getText()).matches()) {
signupEmail.setError("String_Node_Str");
signupEmail.requestFocus();
validForm=false;
}
 else {
txtEmail=signupEmail.getText().toString();
sharedPreferences.edit().putString(ValueHelper.USERNAME,txtEmail).commit();
}
if (signupLastName.getText().length() == 0) {
signupLastName.setError("String_Node_Str");
signupLastName.requestFocus();
validForm=false;
}
 else {
txtLastName=signupLastName.getText().toString();
}
if (signupFirstName.getText().length() == 0) {
signupFirstName.setError("String_Node_Str");
signupFirstName.requestFocus();
validForm=false;
}
 else {
txtFirstName=signupFirstName.getText().toString();
}
if (!signupPrivacyPolicy.isChecked()) {
signupPrivacyPolicy.setError("String_Node_Str");
signupPrivacyPolicy.requestFocus();
validForm=false;
}
if (validForm) {
InputMethodManager inputManager=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(signupEmail.getWindowToken(),0);
RegisterRequest registerRequest=new RegisterRequest();
registerRequest.setFirstName(txtFirstName);
registerRequest.setLastName(txtLastName);
registerRequest.setClientId(txtEmail);
registerRequest.setClientSecret(txtPass);
registerRequest.setOrganization(txtOrg);
registerRequest.setPhone(txtPhone);
MainActivity.progressDialog=new ProgressDialog(getActivity());
MainActivity.progressDialog.setCancelable(false);
MainActivity.progressDialog.setMessage(getActivity().getString(R.string.sign_up_in_progress));
MainActivity.progressDialog.show();
final String finalFirstName=txtFirstName;
final String finalLastName=txtLastName;
Call<TokenResponse> register=Api.instance().getApi().register(registerRequest);
register.enqueue(new Callback<TokenResponse>(){
@Override public void onResponse(Call<TokenResponse> call,Response<TokenResponse> response){
MainActivity.progressDialog.cancel();
if (response.isSuccessful()) {
SharedPreferences mSharedPreferences=getActivity().getSharedPreferences("String_Node_Str",Context.MODE_PRIVATE);
mSharedPreferences.edit().putString(ValueHelper.TOKEN,response.body().getToken()).commit();
Api.instance().setAuthToken(response.body().getToken());
((MainActivity)getActivity()).transitionToMapsFragment();
}
}
@Override public void onFailure(Call<TokenResponse> call,Throwable t){
MainActivity.progressDialog.cancel();
Toast.makeText(getActivity(),t.getMessage(),Toast.LENGTH_SHORT).show();
Timber.tag(TAG).e(t.getMessage());
}
}
);
}
break;
case R.id.fragment_signup_login_already_have_account:
sharedPreferences.edit().putBoolean(ValueHelper.SHOW_SIGNUP_FRAGMENT,false).commit();
sharedPreferences.edit().putBoolean(ValueHelper.SHOW_LOGIN_FRAGMENT,true).commit();
LoginFragment fragment=new LoginFragment();
Bundle bundle=getActivity().getIntent().getExtras();
fragment.setArguments(bundle);
FragmentTransaction fragmentTransaction1=getActivity().getSupportFragmentManager().beginTransaction();
fragmentTransaction1.replace(R.id.container_fragment,fragment).commit();
break;
}
}