Remove unnecessary null checks for mimeType and TransferEncoding

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1051664 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-12-21 21:43:56 +00:00
parent 0dbecf3a49
commit 4f5d4b0d7e
1 changed files with 7 additions and 11 deletions

View File

@ -93,21 +93,17 @@ public class FormBodyPart {
}
protected void generateContentType(final ContentBody body) {
if (body.getMimeType() != null) {
StringBuilder buffer = new StringBuilder();
buffer.append(body.getMimeType());
if (body.getCharset() != null) {
buffer.append(body.getMimeType()); // MimeType cannot be null
if (body.getCharset() != null) { // charset may legitimately be null
buffer.append("; charset=");
buffer.append(body.getCharset());
}
addField(MIME.CONTENT_TYPE, buffer.toString());
}
}
protected void generateTransferEncoding(final ContentBody body) {
if (body.getTransferEncoding() != null) {
addField(MIME.CONTENT_TRANSFER_ENC, body.getTransferEncoding());
}
addField(MIME.CONTENT_TRANSFER_ENC, body.getTransferEncoding()); // TE cannot be null
}
}