in core/src/main/java/org/apache/james/mime4j/stream/FallbackBodyDescriptorBuilder.java [119:147]
public Field addField(RawField field) throws MimeException {
String name = field.getNameLowerCase();
if (name.equals("content-transfer-encoding") && transferEncoding == null) {
String value = field.getBody();
if (value != null) {
value = value.trim().toLowerCase(Locale.US);
if (value.length() > 0) {
transferEncoding = value;
}
}
} else if (name.equals("content-length") && contentLength == -1) {
String value = field.getBody();
if (value != null) {
value = value.trim();
try {
contentLength = Long.parseLong(value.trim());
} catch (NumberFormatException e) {
if (monitor.warn("Invalid content length: " + value,
"ignoring Content-Length header")) {
throw new MimeException("Invalid Content-Length header: " + value);
}
}
}
} else if (name.equals("content-type") && mimeType == null) {
parseContentType(field);
}
return null;
}