#fixed code
                                protected void testRawNoBomValid(final String encoding) throws Exception {
        checkEncoding(XML1, encoding, "UTF-8");
        checkEncoding(XML2, encoding, "UTF-8");
        checkEncoding(XML3, encoding, encoding);
        checkEncoding(XML4, encoding, encoding);
        checkEncoding(XML5, encoding, encoding);
    }
#vulnerable code 
                                protected void testRawNoBomValid(final String encoding) throws Exception {
        InputStream is = getXmlStream("no-bom", XML1, encoding, encoding);
        XmlReader xmlReader = new XmlReader(is, false);
        assertEquals(xmlReader.getEncoding(), "UTF-8");

        is = getXmlStream("no-bom", XML2, encoding, encoding);
        xmlReader = new XmlReader(is);
        assertEquals(xmlReader.getEncoding(), "UTF-8");

        is = getXmlStream("no-bom", XML3, encoding, encoding);
        xmlReader = new XmlReader(is);
        assertEquals(xmlReader.getEncoding(), encoding);

        is = getXmlStream("no-bom", XML4, encoding, encoding);
        xmlReader = new XmlReader(is);
        assertEquals(xmlReader.getEncoding(), encoding);

        is = getXmlStream("no-bom", XML5, encoding, encoding);
        xmlReader = new XmlReader(is);
        assertEquals(xmlReader.getEncoding(), encoding);
    } 
                            #location 12 
                            #vulnerability type RESOURCE_LEAK