#fixed code
                                public void testIterator() {
        Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z");
        
        Iterator<String[]> iterator = CSVFormat.DEFAULT.parse(in).iterator();
        
        assertTrue(iterator.hasNext());
        iterator.remove();
        assertTrue(Arrays.equals(new String[]{"a", "b", "c"}, iterator.next()));
        assertTrue(Arrays.equals(new String[]{"1", "2", "3"}, iterator.next()));
        assertTrue(iterator.hasNext());
        assertTrue(iterator.hasNext());
        assertTrue(iterator.hasNext());
        assertTrue(Arrays.equals(new String[]{"x", "y", "z"}, iterator.next()));
        assertFalse(iterator.hasNext());
        
        try {
            iterator.next();
            fail("NoSuchElementException expected");
        } catch (NoSuchElementException e) {
            // expected
        }
    }
#vulnerable code 
                                public void testIterator() {
        String code = "a,b,c\n1,2,3\nx,y,z";
        Iterator<String[]> iterator = new CSVParser(new StringReader(code)).iterator();
        
        assertTrue(iterator.hasNext());
        iterator.remove();
        assertTrue(Arrays.equals(new String[]{"a", "b", "c"}, iterator.next()));
        assertTrue(Arrays.equals(new String[]{"1", "2", "3"}, iterator.next()));
        assertTrue(iterator.hasNext());
        assertTrue(iterator.hasNext());
        assertTrue(iterator.hasNext());
        assertTrue(Arrays.equals(new String[]{"x", "y", "z"}, iterator.next()));
        assertFalse(iterator.hasNext());
        
        try {
            iterator.next();
            fail("NoSuchElementException expected");
        } catch (NoSuchElementException e) {
            // expected
        }
    } 
                            #location 20 
                            #vulnerability type RESOURCE_LEAK