#vulnerable code 
                                public void title(final String pid, final String title)
        throws IOException {
        if (!this.exists(pid)) {
            throw new IllegalArgumentException(
                new Par(
                    "Project %s doesn't exist, can't change title"
                ).say(pid)
            );
        }
        try (final Item item = this.item()) {
            new Xocument(item.path()).modify(
                new Directives()
                    .xpath(String.format("/catalog/project[@id =  '%s']", pid))
                    .strict(1)
                    .addIf(Catalog.PRJ_TITLE)
                    .set(title)
            );
        }
    } 
                            #location 7 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public void title(final String pid, final String title)
        throws IOException {
        this.checkExist(pid);
        try (final Item item = this.item()) {
            new Xocument(item.path()).modify(
                new Directives()
                    .xpath(String.format("/catalog/project[@id =  '%s']", pid))
                    .strict(1)
                    .addIf(Catalog.PRJ_TITLE)
                    .set(title)
            );
        }
    }