#fixed code
                                File getImage() {
        //获取当前时间作为名字
        Date current = new Date();
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
        String curDate = df.format(current);
        File curPhoto = new File(HERO_PATH, curDate + ".png");
        //截屏存到手机本地
        try {
            while(!curPhoto.exists()) {
                Process process = Runtime.getRuntime().exec(ADB_PATH
                        + " shell /system/bin/screencap -p /sdcard/screenshot.png");
                process.waitFor();
                //将截图放在电脑本地
                process = Runtime.getRuntime().exec(ADB_PATH
                        + " pull /sdcard/screenshot.png " + curPhoto.getAbsolutePath());
                process.waitFor();
            }
            //返回当前图片名字
            return curPhoto;
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.err.println("获取图片失败");
        return null;
    }
#vulnerable code 
                                File getImage() {
        //获取当前时间作为名字
        Date current = new Date();
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
        String curDate = df.format(current);
        File curPhoto = new File(HERO_PATH, curDate + ".png");
        //截屏存到手机本地
        try {
            while(!curPhoto.exists()) {
                Runtime.getRuntime().exec(ADB_PATH
                        + " shell /system/bin/screencap -p /sdcard/screenshot.png");
                Thread.sleep(700);
                //将截图放在电脑本地
                Runtime.getRuntime().exec(ADB_PATH
                        + " pull /sdcard/screenshot.png " + curPhoto.getAbsolutePath());
                Thread.sleep(200);
            }
            //返回当前图片名字
            return curPhoto;
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.err.println("获取图片失败");
        return null;
    } 
                            #location 10 
                            #vulnerability type RESOURCE_LEAK