Program: 161595
Project: 161595
Buggy source:
@Override protected void onHandleIntent(Intent intent){
  ArrayList<ChatMessage> unsentMsg=ChatMessageManager.getAllUnsentUpdated(this);
  if (unsentMsg.size() == 0)   return;
  RSASigner signer=new RSASigner(getPrivateKeyFromSharedPrefs());
  int numberOfAttempts=0;
  while (numberOfAttempts < 5) {
    try {
      for (      ChatMessage message : unsentMsg) {
        String signature=signer.sign(message.getText());
        message.setSignature(signature);
        ChatMessage createdMessage;
        if (message.getId() == 0) {
          createdMessage=ChatClient.getInstance(this).sendMessage(message.getRoom(),message);
          Utils.logv("String_Node_Str" + createdMessage.getText());
        }
 else {
          createdMessage=ChatClient.getInstance(this).updateMessage(message.getRoom(),message);
          Utils.logv("String_Node_Str" + createdMessage.getText());
        }
        createdMessage.setStatus(ChatMessage.STATUS_SENT);
        ChatMessageManager messageManager=new ChatMessageManager(this,message.getRoom());
        messageManager.replaceInto(createdMessage,true);
        messageManager.removeFromUnsent(message);
        Intent i=new Intent("String_Node_Str");
        Bundle extras=new Bundle();
        extras.putString("String_Node_Str","String_Node_Str" + message.getRoom());
        extras.putString("String_Node_Str","String_Node_Str" + message.getMember().getId());
        i.putExtras(extras);
        LocalBroadcastManager.getInstance(this).sendBroadcast(i);
      }
      return;
    }
 catch (    RetrofitError e) {
      Utils.log(e);
      numberOfAttempts++;
    }
    try {
      Thread.sleep(5000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override protected void onHandleIntent(Intent intent){
  ArrayList<ChatMessage> unsentMsg=ChatMessageManager.getAllUnsentUpdated(this);
  if (unsentMsg.size() == 0)   return;
  RSASigner signer=new RSASigner(getPrivateKeyFromSharedPrefs());
  int numberOfAttempts=0;
  while (numberOfAttempts < 5) {
    try {
      for (      ChatMessage message : unsentMsg) {
        String signature=signer.sign(message.getText());
        message.setSignature(signature);
        ChatMessage createdMessage;
        if (message.getId() == 0) {
          createdMessage=ChatClient.getInstance(this).sendMessage(message.getRoom(),message);
          Utils.logv("String_Node_Str" + createdMessage.getText());
        }
 else {
          createdMessage=ChatClient.getInstance(this).updateMessage(message.getRoom(),message);
          Utils.logv("String_Node_Str" + createdMessage.getText());
        }
        createdMessage.setStatus(ChatMessage.STATUS_SENT);
        ChatMessageManager messageManager=new ChatMessageManager(this,message.getRoom());
        messageManager.replaceInto(createdMessage,message.getMember().getId());
        messageManager.removeFromUnsent(message);
        Intent i=new Intent("String_Node_Str");
        Bundle extras=new Bundle();
        extras.putString("String_Node_Str","String_Node_Str" + message.getRoom());
        extras.putString("String_Node_Str","String_Node_Str" + message.getMember().getId());
        i.putExtras(extras);
        LocalBroadcastManager.getInstance(this).sendBroadcast(i);
      }
      return;
    }
 catch (    RetrofitError e) {
      Utils.log(e);
      numberOfAttempts++;
    }
    try {
      Thread.sleep(5000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}