#vulnerable code 
                                public static void main(String[] args) throws IOException {
        // Setting the width and height of frame
        frame.setSize(500, 800);
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        String path=MainGUI.class.getProtectionDomain().getCodeSource().getLocation().getFile();
        path=path.substring(0,path.lastIndexOf("/"));
        System.out.println(path);
        File config = new File(path,  "hero.config");
        System.out.println(config.getAbsolutePath());
        if(config.createNewFile()){
            FileOutputStream fileOutputStream=new FileOutputStream(config);
            fileOutputStream.write("测试".getBytes());
        }else{
            System.out.println("nothing");
        }
        System.out.println(config.getAbsolutePath());

//        创建面板
        JPanel panel = new JPanel();
        frame.add(panel);
        panel.setLayout(null);
        addAdbPath(panel);
        addImagePath(panel);
        addOCRSelection(panel);
        addSearchSelection(panel);
        addSetFinishButton(panel);
        addRunButton(panel);
        addResultTextArea(panel);
        addPatternSelection(panel);
        // 设置界面可见
        frame.setVisible(true);
    } 
                            #location 12 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public static void main(String[] args) throws IOException {
        // Setting the width and height of frame
        frame.setSize(500, 800);
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        try{
            loadConfig();
        }catch (Exception e){
            initConfig();
        }
        loadConfig();
//        创建面板
        JPanel panel = new JPanel();
        frame.add(panel);
        panel.setLayout(null);
        addAdbPath(panel);
        addImagePath(panel);
        addOCRSelection(panel);
        addSearchSelection(panel);
        addSetFinishButton(panel);
        addRunButton(panel);
        addResultTextArea(panel);
        addPatternSelection(panel);
        // 设置界面可见
        frame.setVisible(true);
    }