1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Some code cleanup. No functional changes.

This commit is contained in:
cketti 2011-06-17 04:13:32 +02:00
parent 5eec09d37a
commit 222cd43c80
2 changed files with 11 additions and 30 deletions

View File

@ -77,35 +77,25 @@ public class MimeBodyPart extends BodyPart {
public String getContentType() throws MessagingException {
String contentType = getFirstHeader(MimeHeader.HEADER_CONTENT_TYPE);
if (contentType == null) {
return "text/plain";
} else {
return contentType;
}
return (contentType == null) ? "text/plain" : contentType;
}
public String getDisposition() throws MessagingException {
String contentDisposition = getFirstHeader(MimeHeader.HEADER_CONTENT_DISPOSITION);
if (contentDisposition == null) {
return null;
} else {
return contentDisposition;
}
return getFirstHeader(MimeHeader.HEADER_CONTENT_DISPOSITION);
}
public String getContentId() throws MessagingException {
String contentId = getFirstHeader(MimeHeader.HEADER_CONTENT_ID);
if (contentId == null) {
return null;
} else {
int first = contentId.indexOf('<');
int last = contentId.lastIndexOf('>');
if (first != -1 && last != -1) {
return contentId.substring(first + 1, last);
} else {
return contentId;
}
}
int first = contentId.indexOf('<');
int last = contentId.lastIndexOf('>');
return (first != -1 && last != -1) ?
contentId.substring(first + 1, last) :
contentId;
}
public String getMimeType() throws MessagingException {

View File

@ -130,20 +130,11 @@ public class MimeMessage extends Message {
@Override
public String getContentType() throws MessagingException {
String contentType = getFirstHeader(MimeHeader.HEADER_CONTENT_TYPE);
if (contentType == null) {
return "text/plain";
} else {
return contentType.toLowerCase();
}
return (contentType == null) ? "text/plain" : contentType.toLowerCase();
}
public String getDisposition() throws MessagingException {
String contentDisposition = getFirstHeader(MimeHeader.HEADER_CONTENT_DISPOSITION);
if (contentDisposition == null) {
return null;
} else {
return contentDisposition;
}
return getFirstHeader(MimeHeader.HEADER_CONTENT_DISPOSITION);
}
public String getContentId() throws MessagingException {
return null;