#vulnerable code 
                             public void loadFile(String filename) {
    log(lvl, "loadfile: %s", filename);
		filename = FileManager.slashify(filename, false);
		setSrcBundle(filename + "/");
		File script = new File(filename);
		_editingFile = ScriptRunner.getScriptFile(script);
		if (_editingFile != null) {
			scriptType = _editingFile.getAbsolutePath().substring(_editingFile.getAbsolutePath().lastIndexOf(".") + 1);
			initBeforeLoad(scriptType);
			try {
				this.read(new BufferedReader(new InputStreamReader(
								new FileInputStream(_editingFile), "UTF8")), null);
			} catch (Exception ex) {
				_editingFile = null;
			}
			updateDocumentListeners("loadFile");
			setDirty(false);
			_srcBundleTemp = false;
		}
		if (_editingFile == null) {
			_srcBundlePath = null;
		}
	} 
                            #location 11 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                             public void loadFile(String filename) {
    log(lvl, "loadfile: %s", filename);
		filename = FileManager.slashify(filename, false);
		setSrcBundle(filename + "/");
		File script = new File(filename);
		_editingFile = ScriptRunner.getScriptFile(script);
		if (_editingFile != null) {
			scriptType = _editingFile.getAbsolutePath().substring(_editingFile.getAbsolutePath().lastIndexOf(".") + 1);
			initBeforeLoad(scriptType);
			try {
				if (!readScript(_editingFile)) {
					_editingFile = null;
				}
			} catch (Exception ex) {
				log(-1, "read returned %s", ex.getMessage());
				_editingFile = null;
			}
			updateDocumentListeners("loadFile");
			setDirty(false);
			_srcBundleTemp = false;
		}
		if (_editingFile == null) {
			_srcBundlePath = null;
		}
	}