public boolean addComment(Note bug,NoteComment comment){
  if (!bug.isNew()) {
    Log.d(DEBUG_TAG,"adding note comment" + bug.getId());
    HttpURLConnection connection=null;
    try {
      try {
        String encodedComment=URLEncoder.encode(comment.getText(),"UTF-8");
        URL addCommentUrl=getAddCommentUrl(Long.toString(bug.getId()),encodedComment);
        connection=openConnectionForWriteAccess(addCommentUrl,"POST","text/url");
        OutputStreamWriter out=new OutputStreamWriter(connection.getOutputStream(),Charset.defaultCharset());
        out.flush();
        if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
          throwUnexpectedRequestException(connection);
        }
        parseBug(bug,connection.getInputStream());
        return true;
      }
 catch (      XmlPullParserException e) {
        Log.e(DEBUG_TAG,"addComment:Exception",e);
      }
catch (      IOException e) {
        Log.e(DEBUG_TAG,"addComment:Exception",e);
      }
    }
  finally {
      disconnect(connection);
    }
  }
  return false;
}

public boolean addComment ( Note bug , NoteComment comment ) { if ( ! bug . isNew ( ) ) { Log . d ( DEBUG_TAG , "adding note comment" + bug . getId ( ) ) ; HttpURLConnection connection = null ; try { try { String encodedComment = URLEncoder . encode ( comment . getText ( ) , "UTF-8" ) ; URL addCommentUrl = getAddCommentUrl ( Long . toString ( bug . getId ( ) ) , encodedComment ) ; connection = openConnectionForWriteAccess ( addCommentUrl , "POST" , "text/url" ) ; OutputStreamWriter out = new OutputStreamWriter ( connection . getOutputStream ( ) , Charset . defaultCharset ( ) ) ; out . flush ( ) ; if ( connection . getResponseCode ( ) != HttpURLConnection . HTTP_OK ) { throwUnexpectedRequestException ( connection ) ; } parseBug ( bug , connection . getInputStream ( ) ) ; return true ; } catch ( XmlPullParserException e ) { Log . e ( DEBUG_TAG , "addComment:Exception" , e ) ; } catch ( IOException e ) { Log . e ( DEBUG_TAG , "addComment:Exception" , e ) ; } } finally { disconnect ( connection ) ; } } return false ; }
perform an http request to add the specified comment to the specified bug . blocks until the request is complete .
