Buggy code:
public class Adapter_DoctorList extends BaseExpandableListAdapter { private Context context ; private ArrayList < Model_Doctor > searchedDoctors ; Model_Doctor selectedDoctor ; Model_RatedDoctor ratedDoc ; ListView ratedDocComments ; Adapter_Comments listAdapter ; EditText newComment ; TextView commentDoctorTextView ; Dialog ratingsDialog ; public Adapter_DoctorList ( Context context , ArrayList < Model_Doctor > doctors ) { } @ Override public int getGroupCount ( ) { } @ Override public int getChildrenCount ( int groupPosition ) { } @ Override public Object getGroup ( int groupPosition ) { } @ Override public Object getChild ( int groupPosition , int childPosition ) { } @ Override public long getGroupId ( int groupPosition ) { } @ Override public long getChildId ( int groupPosition , int childPosition ) { } @ Override public boolean hasStableIds ( ) { } @ Override public View getGroupView ( int groupPosition , boolean isExpanded , View convertView , ViewGroup parent ) { } @ Override public View getChildView ( final int groupPosition , int childPosition , boolean isLastChild , View convertView , ViewGroup parent ) { } public class RatingListLoadTask extends AsyncTask < String , Void , String > { String jsonResult ; @ Override protected String doInBackground ( String ... params ) { } private StringBuilder inputStreamToString ( InputStream is ) { } @ Override protected void onPostExecute ( String result ) { try { JSONObject jsonResponse = new JSONObject ( jsonResult ) ; JSONArray jsonMainNode = jsonResponse . optJSONArray ( "docRatings" ) ; JSONObject jsonChildNode = jsonMainNode . getJSONObject ( 0 ) ; int doctorID = Integer . parseInt ( jsonChildNode . optString ( "doctorID" ) ) ; ratedDoc . setRegNo ( doctorID ) ; String doctorName = jsonChildNode . optString ( "doctorName" ) ; ratedDoc . setFullName ( doctorName ) ; String doctorAddress = jsonChildNode . optString ( "docAddress" ) ; ratedDoc . setAddress ( doctorAddress ) ; String doctorRegDate = jsonChildNode . optString ( "docRegDate" ) ; ratedDoc . setRegDate ( doctorRegDate ) ; String docQualification = jsonChildNode . optString ( "docQualification" ) ; ratedDoc . setQualifications ( docQualification ) ; Double docAverageRate = Double . parseDouble ( jsonChildNode . optString ( "docAverageRate" ) ) ; ratedDoc . setAverageRating ( docAverageRate ) ; JSONArray commentsArray = jsonChildNode . optJSONArray ( "comments" ) ; ArrayList < Model_Comment > commentsOfCurrentDoc = new ArrayList < Model_Comment > ( ) ; for ( int j = 0 ; j < ( commentsArray . length ( ) ) ; j ++ ) { JSONObject comment = commentsArray . getJSONObject ( j ) ; Model_Comment currentComment = new Model_Comment ( ) ; currentComment . setCommentID ( Integer . parseInt ( comment . optString ( "commentID" ) ) ) ; currentComment . setComment ( comment . optString ( "comment" ) ) ; currentComment . setNoOfLikes ( Integer . parseInt ( comment . optString ( "noOfLikes" ) ) ) ; currentComment . setRate ( Double . parseDouble ( comment . optString ( "rate" ) ) ) ; commentsOfCurrentDoc . add ( currentComment ) ; } ratedDoc . setComments ( commentsOfCurrentDoc ) ; ratingsDialog = new Dialog ( context ) ; ratingsDialog . setContentView ( view_ratings ) ; ratingsDialog . setTitle ( ( "Reviews:<seq2seq4repair_space>Dr.<seq2seq4repair_space>" + ( selectedDoctor . getFullName ( ) ) ) ) ; ratedDocComments = ( ( ListView ) ( ratingsDialog . findViewById ( RatedDocList ) ) ) ; listAdapter = new Adapter_Comments ( context , ratedDoc . getComments ( ) ) ; ratedDocComments . setAdapter ( listAdapter ) ; commentDoctorTextView = ( ( TextView ) ( ratingsDialog . findViewById ( comment_doctor_textView ) ) ) ; commentDoctorTextView . setText ( ( "Dr.<seq2seq4repair_space>" + ( selectedDoctor . getFullName ( ) ) ) ) ; ratingsDialog . show ( ) ; Button commentSubmitBtn = ( ( Button ) ( ratingsDialog . findViewById ( comment_submit_btn ) ) ) ; commentSubmitBtn . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { newComment = ( ( EditText ) ( ratingsDialog . findViewById ( R . id . newComment ) ) ) ; <START_BUG> String comment = newComment . getText ( ) . toString ( ) ; <END_BUG> boolean isValid = true ; if ( RequiredFieldValidation . isEmpty ( comment ) ) { newComment . setError ( "Please<seq2seq4repair_space>add<seq2seq4repair_space>a<seq2seq4repair_space>comment<seq2seq4repair_space>to<seq2seq4repair_space>submit" ) ; isValid = false ; } if ( isValid ) { Doctor_RateAndComment rate_comment = new Doctor_RateAndComment ( ) ; rate_comment . executeRatingAndCommentTask ( selectedDoctor , 0.0F , comment , context , "Thanks<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>comment!" ) ; ratingsDialog . dismiss ( ) ; new Adapter_DoctorList . RatingListLoadTask ( ) . execute ( ( "http:////sepandroid.esy.es//RatedDoctorsWithComments.php?doctorid=" + ( selectedDoctor . getRegNo ( ) ) ) ) ; } } } ) ; } catch ( JSONException e ) { Toast . makeText ( context , ( "No<seq2seq4repair_space>Ratings<seq2seq4repair_space>for<seq2seq4repair_space>Dr.<seq2seq4repair_space>" + ( selectedDoctor . getFullName ( ) ) ) , LENGTH_LONG ) . show ( ) ; } } } public class RatingTask extends AsyncTask < String , Void , String > { @ Override protected String doInBackground ( String ... params ) { } @ Override protected void onPostExecute ( String result ) { Toast . makeText ( context , "Thanks<seq2seq4repair_space>for<seq2seq4repair_space>rating!!" , LENGTH_SHORT ) . show ( ) ; } } private class JsonReadTask extends AsyncTask < String , Void , String > { @ Override protected String doInBackground ( String ... params ) { } @ Override protected void onPostExecute ( String result ) { Toast . makeText ( context , "Thanks<seq2seq4repair_space>for<seq2seq4repair_space>support" , LENGTH_SHORT ) . show ( ) ; } } public void sendBasicNotification ( Model_Doctor selectedDoc ) { } @ Override public boolean isChildSelectable ( int groupPosition , int childPosition ) { } }

Fix:
String comment = newComment . getText ( ) . toString ( ) . trim ( ) ;