#vulnerable code 
                                @Test(expected = UnsupportedOperationException.class)
    public void testChildEntriesUnmodifiable() throws IOException {
        CompoundDocument document = createTestDocument();

        Entry root = document.getRootEntry();

        assertNotNull(root);

        SortedSet<Entry> children = root.getChildEntries();

        // Should not be allowed, as it modifies the internal structure
        children.remove(children.first());
    } 
                            #location 5 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                @Test(expected = UnsupportedOperationException.class)
    public void testChildEntriesUnmodifiable() throws IOException {
        try (CompoundDocument document = createTestDocument()) {
            Entry root = document.getRootEntry();

            assertNotNull(root);

            SortedSet<Entry> children = root.getChildEntries();

            // Should not be allowed, as it modifies the internal structure
            children.remove(children.first());
        }
    }