#vulnerable code 
                                public String handler(InputStream errorStream) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(errorStream,BaseCommandOption.UTF8));
        StringBuffer sb = new StringBuffer();
        String line;
        try {
            while ((line = reader.readLine()) != null){
                sb.append(line).append("\n");
//                if(log.isDebugEnabled())
//                    log.debug(line);
            }
        }catch (IOException e){
            log.error("read from process error : '{}'",e);
            throw e;
        }finally {
            try {
                errorStream.close();
            }catch (IOException e){
                log.error("close errorStream error: '{}'",e);
            }
        }
        setResult(sb.toString());

        return getResult();
    } 
                            #location 11 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                            public String handler(InputStream errorStream) throws IOException {
    FileChannel inputChannel =null;
    if (errorStream instanceof FileInputStream) {
        inputChannel = ((FileInputStream) errorStream).getChannel();
    } else{

        return "";
    }
    ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(4096);
    ByteBuffer buffer = ByteBuffer.allocate(4096);
    StringBuffer sb = new StringBuffer();

    try {
        while (inputChannel.read(buffer) > -1) {
            buffer.flip();
            sb.append(buffer.get());
            buffer.clear();
        }
    } catch (IOException e) {
        // 当脚本执行超时，由于channel的关闭必然会抛出异常
        log.error("read from process error : '{}'",e);
        throw e;
    }
    finally {
        if(inputChannel!=null)
            inputChannel.close();
    }
    setResult(sb.toString());
    return getResult();
}