private void filterHeaders(org.apache.james.mime4j.dom.Header header) throws MimeException { ArrayList<Field> modifiedFields = new ArrayList<Field>(); for (Field field : header) { Field filtered = filterField(field); if (filtered != null) { modifiedFields.add(filtered); } } if (!hasFromField) { Field newFrom = createFromField(); if (newFrom != null) { modifiedFields.add(newFrom); } } for (Field field : modifiedFields) { header.setField(field); } }
/** @see org.apache.james.mime4j.parser.AbstractContentHandler#field(RawField) */ @Override public final void field(RawField field) throws MimeException { Field parsedField = DefaultFieldParser.parse(field.getRaw(), monitor); currHeader.addField(parsedField); }