1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -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 { public String getContentType() throws MessagingException {
String contentType = getFirstHeader(MimeHeader.HEADER_CONTENT_TYPE); String contentType = getFirstHeader(MimeHeader.HEADER_CONTENT_TYPE);
if (contentType == null) { return (contentType == null) ? "text/plain" : contentType;
return "text/plain";
} else {
return contentType;
}
} }
public String getDisposition() throws MessagingException { public String getDisposition() throws MessagingException {
String contentDisposition = getFirstHeader(MimeHeader.HEADER_CONTENT_DISPOSITION); return getFirstHeader(MimeHeader.HEADER_CONTENT_DISPOSITION);
if (contentDisposition == null) {
return null;
} else {
return contentDisposition;
}
} }
public String getContentId() throws MessagingException { public String getContentId() throws MessagingException {
String contentId = getFirstHeader(MimeHeader.HEADER_CONTENT_ID); String contentId = getFirstHeader(MimeHeader.HEADER_CONTENT_ID);
if (contentId == null) { if (contentId == null) {
return null; return null;
} else { }
int first = contentId.indexOf('<'); int first = contentId.indexOf('<');
int last = contentId.lastIndexOf('>'); int last = contentId.lastIndexOf('>');
if (first != -1 && last != -1) {
return contentId.substring(first + 1, last); return (first != -1 && last != -1) ?
} else { contentId.substring(first + 1, last) :
return contentId; contentId;
}
}
} }
public String getMimeType() throws MessagingException { public String getMimeType() throws MessagingException {

View File

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