Buggy code:
public class EditProfileActivity extends Activity { private LinearLayout messagesHolder ; public void doUpdateProfile ( View view ) { String old_pw = ( ( android . widget . EditText ) ( findViewById ( R . id . old_password_field ) ) ) . getText ( ) . toString ( ) ; String new_pw = ( ( android . widget . EditText ) ( findViewById ( R . id . password_field ) ) ) . getText ( ) . toString ( ) ; String new_cpw = ( ( android . widget . EditText ) ( findViewById ( R . id . confirm_field ) ) ) . getText ( ) . toString ( ) ; if ( ( ! ( old_pw . isEmpty ( ) ) ) || ( ( ( ! ( old_pw . isEmpty ( ) ) ) && ( ! ( new_pw . isEmpty ( ) ) ) ) && ( ! ( new_cpw . isEmpty ( ) ) ) ) ) { int id = Global . getUser ( ) . getId ( ) ; String passportNumber = ( ( android . widget . EditText ) ( findViewById ( R . id . passport_field ) ) ) . getText ( ) . toString ( ) ; String fullName = ( ( android . widget . EditText ) ( findViewById ( R . id . name_field ) ) ) . getText ( ) . toString ( ) ; String address = ( ( android . widget . EditText ) ( findViewById ( R . id . address_field ) ) ) . getText ( ) . toString ( ) ; String email = ( ( android . widget . EditText ) ( findViewById ( R . id . email_field ) ) ) . getText ( ) . toString ( ) ; String dateOfBirth = ( ( android . widget . EditText ) ( findViewById ( R . id . dob_field ) ) ) . getText ( ) . toString ( ) ; String gender = ( ( android . widget . EditText ) ( findViewById ( R . id . gender_field ) ) ) . getText ( ) . toString ( ) ; String nationality = ( ( android . widget . EditText ) ( findViewById ( R . id . nationality_field ) ) ) . getText ( ) . toString ( ) ; HashMap < String , String > data = new HashMap < String , String > ( ) ; data . put ( "id" , ( "" + id ) ) ; data . put ( "email" , email ) ; <START_BUG> data . put ( "password" , new_pw ) ; <END_BUG> data . put ( "full_name" , fullName ) ; data . put ( "address" , address ) ; data . put ( "gender" , gender ) ; data . put ( "passport_number" , passportNumber ) ; data . put ( "nationality" , nationality ) ; data . put ( "date_of_birth" , dateOfBirth ) ; data . put ( "session_id" , Global . getStringPrefs ( "session_id" ) ) ; view . setEnabled ( false ) ; ProgressDialog pd = ProgressDialog . show ( this , "Updating<seq2seq4repair_space>profile<seq2seq4repair_space>..." , "Please<seq2seq4repair_space>wait!" , true ) ; messagesHolder . removeAllViews ( ) ; new android . os . AsyncTask < Void , Void , String > ( ) { private View view ; private ProgressDialog pd ; private LinearLayout mh ; private HashMap < String , String > data ; public android . os . AsyncTask < Void , Void , String > init ( View view , ProgressDialog pd , LinearLayout mh , HashMap < String , String > data ) { this . view = view ; this . pd = pd ; this . mh = mh ; this . data = data ; return this ; } @ Override protected String doInBackground ( Void ... params ) { return new HttpPostRequest ( data ) . send ( USER_UPDATE_URL ) ; } @ Override protected void onPostExecute ( String result ) { int status = - 1 ; try { JSONObject response = new JSONObject ( result ) ; JSONArray messages = response . getJSONArray ( "message" ) ; status = response . getInt ( "status" ) ; switch ( status ) { case 0 : Global . fetchUserDetails ( ) ; pd . dismiss ( ) ; new AlertDialog . Builder ( EditProfileActivity . this ) . setIcon ( ic_dialog_info ) . setMessage ( "Profile<seq2seq4repair_space>successfully<seq2seq4repair_space>updated!" ) . setTitle ( "Profile<seq2seq4repair_space>Update" ) . setNeutralButton ( "OK" , new DialogInterface . OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int which ) { EditProfileActivity . this . finish ( ) ; } } ) . show ( ) ; return ; default : pd . dismiss ( ) ; for ( int i = 0 , size = messages . length ( ) ; i < size ; ++ i ) { TextView textView = new TextView ( EditProfileActivity . this ) ; textView . setLayoutParams ( new LayoutParams ( LayoutParams . WRAP_CONTENT , LayoutParams . WRAP_CONTENT ) ) ; textView . setText ( messages . getString ( i ) ) ; mh . addView ( textView ) ; } break ; } } catch ( JSONException e ) { pd . dismiss ( ) ; } view . setEnabled ( true ) ; } } . init ( view , pd , messagesHolder , data ) . executeOnExecutor ( THREAD_POOL_EXECUTOR ) ; } } @ Override protected void onCreate ( Bundle savedInstanceState ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } }

Fix:
data . put ( "password" , ( new_pw . isEmpty ( ) ? old_pw : new_pw ) ) ;