#vulnerable code 
                             public void extract(InputStream input) throws Exception {
		// First, extract properties
		this.reader = new POIFSReader();

		this.reader.registerListener(new PropertiesReaderListener(),
				SummaryInformation.DEFAULT_STREAM_NAME);

		RereadableInputStream ris = new RereadableInputStream(input,
				MEMORY_THRESHOLD);
		if (input.available() > 0) {
			reader.read(ris);
		}
		while (ris.read() != -1) {
		}
		ris.rewind();
		// Extract document full text
		this.text = extractText(ris);
	} 
                            #location 17 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                             public void extract(InputStream input) throws Exception {
		RereadableInputStream ris = new RereadableInputStream(input,
				MEMORY_THRESHOLD);
		try {
			// First, extract properties
			this.reader = new POIFSReader();

			this.reader.registerListener(new PropertiesReaderListener(),
					SummaryInformation.DEFAULT_STREAM_NAME);

			if (input.available() > 0) {
				reader.read(ris);
			}
			while (ris.read() != -1) {
			}
			ris.rewind();
			// Extract document full text
			this.text = extractText(ris);
		} finally {
			ris.close();
		}
	}