Program: 161641
Project: 161641
Buggy source:
@Override public void onClick(View view){
  if (view.getId() == btnSend.getId()) {
    ChatMessage newMessage=new ChatMessage(etMessage.getText().toString(),currentChatMember.getUrl());
    if (privateKey == null) {
      SharedPreferences sharedPrefs=PreferenceManager.getDefaultSharedPreferences(this);
      if (sharedPrefs.contains(Const.PRIVATE_KEY)) {
        privateKey=new Gson().fromJson(sharedPrefs.getString(Const.PRIVATE_KEY,"String_Node_Str"),PrivateKey.class);
      }
 else {
        KeyPairGenerator keyGen=null;
        try {
          keyGen=KeyPairGenerator.getInstance("String_Node_Str");
        }
 catch (        NoSuchAlgorithmException e) {
          e.printStackTrace();
        }
        keyGen.initialize(1024);
        KeyPair keyPair=keyGen.generateKeyPair();
        byte[] publicKey=keyPair.getPublic().getEncoded();
        String publicKeyString=Base64.encodeToString(publicKey,Base64.DEFAULT);
        privateKey=keyPair.getPrivate();
        Editor editor=sharedPrefs.edit();
        editor.putString(Const.PRIVATE_KEY,new Gson().toJson(privateKey));
        editor.commit();
        ChatClient.getInstance().uploadPublicKey(currentChatMember.getUserId(),new ChatPublicKey(publicKeyString),new Callback<ChatPublicKey>(){
          @Override public void success(          ChatPublicKey arg0,          Response arg1){
            Log.d("String_Node_Str",arg0.toString());
          }
          @Override public void failure(          RetrofitError arg0){
            Log.d("String_Node_Str",arg0.toString());
          }
        }
);
      }
    }
    RSASigner signer=new RSASigner(privateKey);
    newMessage.setSignature(signer.sign(newMessage.getText()));
    ChatClient.getInstance().sendMessage(currentChatRoom.getGroupId(),newMessage,new Callback<ChatMessage>(){
      @Override public void success(      ChatMessage arg0,      Response arg1){
        Log.d("String_Node_Str",arg0.toString());
      }
      @Override public void failure(      RetrofitError arg0){
        Log.d("String_Node_Str",arg0.toString());
      }
    }
);
    etMessage.setText("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onClick(View view){
  if (view.getId() == btnSend.getId()) {
    ChatMessage newMessage=new ChatMessage(etMessage.getText().toString(),currentChatMember.getUrl());
    if (privateKey == null) {
      SharedPreferences sharedPrefs=PreferenceManager.getDefaultSharedPreferences(this);
      if (sharedPrefs.contains(Const.PRIVATE_KEY)) {
        String privateKeyString=sharedPrefs.getString(Const.PRIVATE_KEY,"String_Node_Str");
        byte[] privateKeyBytes=Base64.decode(privateKeyString,Base64.DEFAULT);
        KeyFactory keyFactory;
        try {
          keyFactory=KeyFactory.getInstance("String_Node_Str");
          PKCS8EncodedKeySpec privateKeySpec=new PKCS8EncodedKeySpec(privateKeyBytes);
          privateKey=keyFactory.generatePrivate(privateKeySpec);
        }
 catch (        NoSuchAlgorithmException e) {
          e.printStackTrace();
        }
catch (        InvalidKeySpecException e) {
          e.printStackTrace();
        }
      }
 else {
        KeyPairGenerator keyGen=null;
        try {
          keyGen=KeyPairGenerator.getInstance("String_Node_Str");
        }
 catch (        NoSuchAlgorithmException e) {
          e.printStackTrace();
        }
        keyGen.initialize(1024);
        KeyPair keyPair=keyGen.generateKeyPair();
        byte[] publicKey=keyPair.getPublic().getEncoded();
        String publicKeyString=Base64.encodeToString(publicKey,Base64.DEFAULT);
        privateKey=keyPair.getPrivate();
        String privateKeyString=Base64.encodeToString(privateKey.getEncoded(),Base64.DEFAULT);
        Editor editor=sharedPrefs.edit();
        editor.putString(Const.PRIVATE_KEY,privateKeyString);
        editor.commit();
        ChatClient.getInstance().uploadPublicKey(currentChatMember.getUserId(),new ChatPublicKey(publicKeyString),new Callback<ChatPublicKey>(){
          @Override public void success(          ChatPublicKey arg0,          Response arg1){
            Log.d("String_Node_Str",arg0.toString());
            Utils.showLongCenteredToast(ChatActivity.this,"String_Node_Str" + currentChatMember.getLrzId() + "String_Node_Str");
          }
          @Override public void failure(          RetrofitError arg0){
            Log.e("String_Node_Str",arg0.toString());
          }
        }
);
      }
    }
    RSASigner signer=new RSASigner(privateKey);
    String signature=signer.sign(newMessage.getText());
    newMessage.setSignature(signature);
    ChatClient.getInstance().sendMessage(currentChatRoom.getGroupId(),newMessage,new Callback<ChatMessage>(){
      @Override public void success(      ChatMessage arg0,      Response arg1){
        Log.d("String_Node_Str",arg0.toString());
      }
      @Override public void failure(      RetrofitError arg0){
        Log.e("String_Node_Str",arg0.getMessage() + "String_Node_Str" + arg0.getCause());
      }
    }
);
    etMessage.setText("String_Node_Str");
  }
}