Program: 32209
Project: 32209
Buggy source:
/** 
 * check if the text message is an IRC command. If it is an IRC command, it is executed
 * @param body
 * @return true if body defines an IRC command
 */
private boolean manageIRCCommand(String body){
  boolean isIRCCmd=false;
  if ((null != body) && (body.startsWith("String_Node_Str"))) {
    final ApiCallback callback=new SimpleApiCallback<Void>(this){
      @Override public void onMatrixError(      MatrixError e){
        if (MatrixError.FORBIDDEN.equals(e.errcode)) {
          Toast.makeText(RoomActivity.this,e.error,Toast.LENGTH_LONG).show();
        }
      }
    }
;
    if (body.startsWith(CMD_CHANGE_DISPLAY_NAME)) {
      isIRCCmd=true;
      String newDisplayname=body.substring(CMD_CHANGE_DISPLAY_NAME.length()).trim();
      if (newDisplayname.length() > 0) {
        MyUser myUser=mSession.getMyUser();
        myUser.updateDisplayName(newDisplayname,callback);
      }
    }
 else     if (body.startsWith(CMD_EMOTE)) {
      isIRCCmd=true;
      String message=body.substring(CMD_EMOTE.length()).trim();
      if (message.length() > 0) {
        mConsoleMessageListFragment.sendEmote(message);
      }
    }
 else     if (body.startsWith(CMD_JOIN_ROOM)) {
      isIRCCmd=true;
      String roomAlias=body.substring(CMD_JOIN_ROOM.length()).trim();
      if (roomAlias.length() > 0) {
        mSession.joinRoom(roomAlias,new SimpleApiCallback<String>(this){
          @Override public void onSuccess(          String roomId){
            if (null != roomId) {
              CommonActivityUtils.goToRoomPage(roomId,RoomActivity.this,null);
            }
          }
        }
);
      }
    }
 else     if (body.startsWith(CMD_KICK_USER)) {
      isIRCCmd=true;
      String params=body.substring(CMD_KICK_USER.length()).trim();
      String[] paramsList=params.split("String_Node_Str");
      String kickedUserID=paramsList[0];
      if (kickedUserID.length() > 0) {
        mRoom.kick(kickedUserID,callback);
      }
    }
 else     if (body.startsWith(CMD_BAN_USER)) {
      isIRCCmd=true;
      String params=body.substring(CMD_BAN_USER.length()).trim();
      String[] paramsList=params.split("String_Node_Str");
      String bannedUserID=paramsList[0];
      String reason=params.substring(bannedUserID.length()).trim();
      if (bannedUserID.length() > 0) {
        mRoom.ban(bannedUserID,reason,callback);
      }
    }
 else     if (body.startsWith(CMD_UNBAN_USER)) {
      isIRCCmd=true;
      String params=body.substring(CMD_UNBAN_USER.length()).trim();
      String[] paramsList=params.split("String_Node_Str");
      String unbannedUserID=paramsList[0];
      if (unbannedUserID.length() > 0) {
        mRoom.unban(unbannedUserID,callback);
      }
    }
 else     if (body.startsWith(CMD_SET_USER_POWER_LEVEL)) {
      isIRCCmd=true;
      String params=body.substring(CMD_SET_USER_POWER_LEVEL.length()).trim();
      String[] paramsList=params.split("String_Node_Str");
      String userID=paramsList[0];
      String powerLevelsAsString=params.substring(userID.length()).trim();
      try {
        if ((userID.length() > 0) && (powerLevelsAsString.length() > 0)) {
          mRoom.updateUserPowerLevels(userID,Integer.parseInt(powerLevelsAsString),callback);
        }
      }
 catch (      Exception e) {
      }
    }
 else     if (body.startsWith(CMD_RESET_USER_POWER_LEVEL)) {
      isIRCCmd=true;
      String params=body.substring(CMD_RESET_USER_POWER_LEVEL.length()).trim();
      String[] paramsList=params.split("String_Node_Str");
      String userID=paramsList[0];
      if (userID.length() > 0) {
        mRoom.updateUserPowerLevels(userID,0,callback);
      }
    }
  }
  return isIRCCmd;
}

Fixed version (ground truth):
/** 
 * check if the text message is an IRC command. If it is an IRC command, it is executed
 * @param body
 * @return true if body defines an IRC command
 */
private boolean manageIRCCommand(String body){
  boolean isIRCCmd=false;
  if ((null != body) && (body.startsWith("String_Node_Str"))) {
    final ApiCallback callback=new SimpleApiCallback<Void>(this){
      @Override public void onMatrixError(      MatrixError e){
        if (MatrixError.FORBIDDEN.equals(e.errcode)) {
          Toast.makeText(RoomActivity.this,e.error,Toast.LENGTH_LONG).show();
        }
      }
    }
;
    if (body.startsWith(CMD_CHANGE_DISPLAY_NAME)) {
      isIRCCmd=true;
      String newDisplayname=body.substring(CMD_CHANGE_DISPLAY_NAME.length()).trim();
      if (newDisplayname.length() > 0) {
        MyUser myUser=mSession.getMyUser();
        myUser.updateDisplayName(newDisplayname,callback);
      }
    }
 else     if (body.startsWith(CMD_EMOTE)) {
      isIRCCmd=true;
      String message=body.substring(CMD_EMOTE.length()).trim();
      if (message.length() > 0) {
        mConsoleMessageListFragment.sendEmote(message);
      }
    }
 else     if (body.startsWith(CMD_JOIN_ROOM)) {
      isIRCCmd=true;
      String roomAlias=body.substring(CMD_JOIN_ROOM.length()).trim();
      if (roomAlias.length() > 0) {
        mSession.joinRoom(roomAlias,new SimpleApiCallback<String>(this){
          @Override public void onSuccess(          String roomId){
            if (null != roomId) {
              CommonActivityUtils.goToRoomPage(mSession,roomId,RoomActivity.this,null);
            }
          }
        }
);
      }
    }
 else     if (body.startsWith(CMD_KICK_USER)) {
      isIRCCmd=true;
      String params=body.substring(CMD_KICK_USER.length()).trim();
      String[] paramsList=params.split("String_Node_Str");
      String kickedUserID=paramsList[0];
      if (kickedUserID.length() > 0) {
        mRoom.kick(kickedUserID,callback);
      }
    }
 else     if (body.startsWith(CMD_BAN_USER)) {
      isIRCCmd=true;
      String params=body.substring(CMD_BAN_USER.length()).trim();
      String[] paramsList=params.split("String_Node_Str");
      String bannedUserID=paramsList[0];
      String reason=params.substring(bannedUserID.length()).trim();
      if (bannedUserID.length() > 0) {
        mRoom.ban(bannedUserID,reason,callback);
      }
    }
 else     if (body.startsWith(CMD_UNBAN_USER)) {
      isIRCCmd=true;
      String params=body.substring(CMD_UNBAN_USER.length()).trim();
      String[] paramsList=params.split("String_Node_Str");
      String unbannedUserID=paramsList[0];
      if (unbannedUserID.length() > 0) {
        mRoom.unban(unbannedUserID,callback);
      }
    }
 else     if (body.startsWith(CMD_SET_USER_POWER_LEVEL)) {
      isIRCCmd=true;
      String params=body.substring(CMD_SET_USER_POWER_LEVEL.length()).trim();
      String[] paramsList=params.split("String_Node_Str");
      String userID=paramsList[0];
      String powerLevelsAsString=params.substring(userID.length()).trim();
      try {
        if ((userID.length() > 0) && (powerLevelsAsString.length() > 0)) {
          mRoom.updateUserPowerLevels(userID,Integer.parseInt(powerLevelsAsString),callback);
        }
      }
 catch (      Exception e) {
      }
    }
 else     if (body.startsWith(CMD_RESET_USER_POWER_LEVEL)) {
      isIRCCmd=true;
      String params=body.substring(CMD_RESET_USER_POWER_LEVEL.length()).trim();
      String[] paramsList=params.split("String_Node_Str");
      String userID=paramsList[0];
      if (userID.length() > 0) {
        mRoom.updateUserPowerLevels(userID,0,callback);
      }
    }
  }
  return isIRCCmd;
}