#vulnerable code 
                             public static String readFileInClasspath(String url) throws Exception {
		StringBuffer bufferJSON = new StringBuffer();
		
		try {
			InputStream ips= ElasticsearchAbstractClientFactoryBean.class.getResourceAsStream(url); 
			InputStreamReader ipsr = new InputStreamReader(ips);
			BufferedReader br = new BufferedReader(ipsr);
			String line;
			
			while ((line=br.readLine())!=null){
				bufferJSON.append(line);
			}
			br.close();
		} catch (Exception e){
			return null;
		}

		return bufferJSON.toString();
	} 
                            #location 14 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public static String readFileInClasspath(String url) throws Exception {
        StringBuilder bufferJSON = new StringBuilder();

        BufferedReader br = null;

        try {
            ClassPathResource classPathResource = new ClassPathResource(url);
            InputStreamReader ipsr = new InputStreamReader(classPathResource.getInputStream());
            br = new BufferedReader(ipsr);
            String line;

            while ((line = br.readLine()) != null) {
                bufferJSON.append(line);
            }
        } catch (Exception e) {
            logger.error(String.format("Failed to load file from url: %s", url), e);
            return null;
        } finally {
            if (br != null) br.close();
        }

        return bufferJSON.toString();
    }