With the help of @LukeWoodward, I did find my mistake and that
upd.getChatMember() was the one responsible for giving me the null pointer exception.
upd.getChatMember() will be null if the messages are coming from direct DMs in Telegram and not from group chats. For that, you need to use
upd.getMessage().getFrom().getId() for getting the user’s id who direct messaged your bot.
CLICK HERE to find out more related problems solutions.