[prev in list] [next in list] [prev in thread] [next in thread]
List: httpcomponents-commits
Subject: svn commit: r1051664 -
From: sebb () apache ! org
Date: 2010-12-21 21:43:57
Message-ID: 20101221214357.3C5FF2388A4B () eris ! apache ! org
[Download RAW message or body]
Author: sebb
Date: Tue Dec 21 21:43:56 2010
New Revision: 1051664
URL: http://svn.apache.org/viewvc?rev=1051664&view=rev
Log:
Remove unnecessary null checks for mimeType and TransferEncoding
Modified:
httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/FormBodyPart.java
Modified: httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/FormBodyPart.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpmime/src/main/ja \
va/org/apache/http/entity/mime/FormBodyPart.java?rev=1051664&r1=1051663&r2=1051664&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/FormBodyPart.java \
(original)
+++ httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/FormBodyPart.java \
Tue Dec 21 21:43:56 2010 @@ -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("; charset=");
- buffer.append(body.getCharset());
- }
- addField(MIME.CONTENT_TYPE, buffer.toString());
+ StringBuilder buffer = new StringBuilder();
+ 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 }
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic