#vulnerable code 
                                public void readDotTerminatedContent(BufferedReader in)
            throws IOException {
        content = workspace.getTmpFile();
        Writer data = content.getWriter();
        PrintWriter dataWriter = new InternetPrintWriter(data);

        while (true) {
            String line = in.readLine();
            if (line == null)
                throw new EOFException("Did not receive <CRLF>.<CRLF>");

            if (".".equals(line)) {
                dataWriter.close();

                break;
            } else if (line.startsWith(".")) {
                dataWriter.println(line.substring(1));
            } else {
                dataWriter.println(line);
            }
        }
        try {
            message = GreenMailUtil.newMimeMessage(content.getAsString());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    } 
                            #location 20 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public void readDotTerminatedContent(BufferedReader in)
            throws IOException {
        StringBuilder buf = new StringBuilder();

        while (true) {
            String line = in.readLine();
            if (line == null)
                throw new EOFException("Did not receive <CRLF>.<CRLF>");

            if (".".equals(line)) {
                break;
            } else if (line.startsWith(".")) {
                println(buf, line.substring(1));
            } else {
                println(buf, line);
            }
        }
        content = buf.toString();
        try {
            message = GreenMailUtil.newMimeMessage(content);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }