private List convertFields()

in main/src/main/java/org/apache/james/jdkim/impl/Message.java [89:110]


    private List<String> convertFields(List<Field> res) {
        List<String> res2 = new LinkedList<>();
        MessageWriter mw;
        try {
            mw = newMessageBuilder().newMessageWriter();
        } catch (MimeException e1) {
            return res2;
        }
        for (Field f : res) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            String field = null;
            try {
                mw.writeField(f, bos);
                // writeField always ends with CRLF and we don't want it.
                byte[] fieldbytes = bos.toByteArray();
                field = new String(fieldbytes, 0, fieldbytes.length - 2);
            } catch (IOException ignored) {
            }
            res2.add(field);
        }
        return res2;
    }