#vulnerable code 
                                public String title(final String pid) throws IOException {
        if (!this.exists(pid)) {
            throw new IllegalArgumentException(
                new Par(
                    "Project %s doesn't exist, can't get title"
                ).say(pid)
            );
        }
        try (final Item item = this.item()) {
            final Iterator<String> items = new Xocument(item.path())
                .xpath(
                    String.format(
                        "/catalog/project[@id = '%s']/title/text()",
                        pid
                    )
                ).iterator();
            String title = pid;
            if (items.hasNext()) {
                title = items.next();
            }
            return title;
        }
    } 
                            #location 6 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public String title(final String pid) throws IOException {
        this.checkExist(pid);
        try (final Item item = this.item()) {
            final Iterator<String> items = new Xocument(item.path())
                .xpath(
                    String.format(
                        "/catalog/project[@id = '%s']/title/text()",
                        pid
                    )
                ).iterator();
            String title = pid;
            if (items.hasNext()) {
                title = items.next();
            }
            return title;
        }
    }