#fixed code
                                @Override
    public void execute(CommandSender sender, String[] args) {
        PluginConfig config = Settings.getConfig();
        MessagesConfig messages = Messages.getInstance();
        Player player = (Player) sender;
        User user = User.get(player);
        Guild guild = user.getGuild();

        if (!user.hasGuild()) {
            player.sendMessage(messages.validityHasNotGuild);
            return;
        }

        if (!user.isOwner() && !user.isDeputy()) {
            player.sendMessage(messages.validityIsNotOwner);
            return;
        }

        if (config.validityWhen != 0) {
            long c = guild.getValidity();
            long d = c - System.currentTimeMillis();
            
            if (d > config.validityWhen) {
                long when = d - config.validityWhen;
                player.sendMessage(messages.validityWhen.replace("{TIME}", TimeUtils.getDurationBreakdown(when)));
                return;
            }
        }

        List<ItemStack> itemsList = config.validityItems;
        for (ItemStack itemStack : itemsList) {
            if (!player.getInventory().containsAtLeast(itemStack, itemStack.getAmount())) {
                String msg = messages.validityItems;
                if (msg.contains("{ITEM}")) {
                    StringBuilder sb = new StringBuilder();
                    sb.append(itemStack.getAmount());
                    sb.append(" ");
                    sb.append(itemStack.getType().toString().toLowerCase());
                    msg = msg.replace("{ITEM}", sb.toString());
                }
                
                if (msg.contains("{ITEMS}")) {
                    ArrayList<String> list = new ArrayList<String>();
                    for (ItemStack it : itemsList) {
                        StringBuilder sb = new StringBuilder();
                        sb.append(it.getAmount());
                        sb.append(" ");
                        sb.append(it.getType().toString().toLowerCase());
                        list.add(sb.toString());
                    }
                    
                    msg = msg.replace("{ITEMS}", StringUtils.toString(list, true));
                }
                
                player.sendMessage(msg);
                return;
            }
            
            player.getInventory().removeItem(itemStack);
        }

        long c = guild.getValidity();
        if (c == 0) {
            c = System.currentTimeMillis();
        }

        c += config.validityTime;
        guild.setValidity(c);

        player.sendMessage(messages.validityDone.replace("{DATE}", config.dateFormat.format(new Date(c))));
    }
#vulnerable code 
                                @Override
    public void execute(CommandSender sender, String[] args) {
        PluginConfig pc = Settings.getConfig();
        MessagesConfig m = Messages.getInstance();
        Player p = (Player) sender;
        User user = User.get(p);
        Guild guild = user.getGuild();

        if (!user.hasGuild()) {
            p.sendMessage(m.validityHasNotGuild);
            return;
        }

        if (!user.isOwner() && !user.isDeputy()) {
            p.sendMessage(m.validityIsNotOwner);
            return;
        }

        if (pc.validityWhen != 0) {
            long c = guild.getValidity();
            long d = c - System.currentTimeMillis();
            
            if (d > pc.validityWhen) {
                long when = d - pc.validityWhen;
                p.sendMessage(m.validityWhen.replace("{TIME}", TimeUtils.getDurationBreakdown(when)));
                return;
            }
        }

        List<ItemStack> itemsList = pc.validityItems;
        for (ItemStack itemStack : itemsList) {
            if (!p.getInventory().containsAtLeast(itemStack, itemStack.getAmount())) {
                String msg = m.validityItems;
                if (msg.contains("{ITEM}")) {
                    StringBuilder sb = new StringBuilder();
                    sb.append(itemStack.getAmount());
                    sb.append(" ");
                    sb.append(itemStack.getType().toString().toLowerCase());
                    msg = msg.replace("{ITEM}", sb.toString());
                }
                
                if (msg.contains("{ITEMS}")) {
                    ArrayList<String> list = new ArrayList<String>();
                    for (ItemStack it : itemsList) {
                        StringBuilder sb = new StringBuilder();
                        sb.append(it.getAmount());
                        sb.append(" ");
                        sb.append(it.getType().toString().toLowerCase());
                        list.add(sb.toString());
                    }
                    
                    msg = msg.replace("{ITEMS}", StringUtils.toString(list, true));
                }
                
                p.sendMessage(msg);
                return;
            }
            
            p.getInventory().removeItem(itemStack);
        }

        long c = guild.getValidity();
        if (c == 0) {
            c = System.currentTimeMillis();
        }

        c += pc.validityTime;
        guild.setValidity(c);

        p.sendMessage(m.validityDone.replace("{DATE}", pc.dateFormat.format(new Date(c))));
    } 
                            #location 10 
                            #vulnerability type NULL_DEREFERENCE