1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

Flagged some code with TODOs, added Javadoc for Body

This commit is contained in:
Tobias Baum 2014-09-14 11:20:18 +02:00
parent be954d729c
commit 1ea34d2378
4 changed files with 18 additions and 3 deletions

View File

@ -8,7 +8,21 @@ import java.io.OutputStream;
import com.fsck.k9.mail.store.UnavailableStorageException; import com.fsck.k9.mail.store.UnavailableStorageException;
public interface Body { public interface Body {
/**
* Returns the raw data of the body, without transfer encoding etc applied.
* TODO perhaps it would be better to have an intermediate "simple part" class where this method could reside
* because it makes no sense for multiparts
*/
public InputStream getInputStream() throws MessagingException; public InputStream getInputStream() throws MessagingException;
/**
* Sets the content transfer encoding (7bit, 8bit, quoted-printable or base64).
*/
public void setEncoding(String encoding) throws UnavailableStorageException, MessagingException; public void setEncoding(String encoding) throws UnavailableStorageException, MessagingException;
/**
* Writes the body's data to the given {@link OutputStream}.
* The written data is transfer encoded (e.g. transformed to Base64 when needed).
*/
public void writeTo(OutputStream out) throws IOException, MessagingException; public void writeTo(OutputStream out) throws IOException, MessagingException;
} }

View File

@ -14,5 +14,6 @@ public abstract class BodyPart implements Part {
public abstract void setEncoding(String encoding) throws MessagingException; public abstract void setEncoding(String encoding) throws MessagingException;
@Override
public abstract void setUsing7bitTransport() throws MessagingException; public abstract void setUsing7bitTransport() throws MessagingException;
} }

View File

@ -28,9 +28,9 @@ public class MessagingException extends Exception {
return permanentFailure; return permanentFailure;
} }
//TODO setters in Exception are bad style, remove (it's nearly unused anyway)
public void setPermanentFailure(boolean permanentFailure) { public void setPermanentFailure(boolean permanentFailure) {
this.permanentFailure = permanentFailure; this.permanentFailure = permanentFailure;
} }
} }

View File

@ -511,6 +511,7 @@ public class SmtpTransport extends Transport {
if (mLargestAcceptableMessage > 0 && ((LocalMessage)message).hasAttachments()) { if (mLargestAcceptableMessage > 0 && ((LocalMessage)message).hasAttachments()) {
if (message.calculateSize() > mLargestAcceptableMessage) { if (message.calculateSize() > mLargestAcceptableMessage) {
MessagingException me = new MessagingException("Message too large for server"); MessagingException me = new MessagingException("Message too large for server");
//TODO this looks rather suspicious... shouldn't it be true?
me.setPermanentFailure(possibleSend); me.setPermanentFailure(possibleSend);
throw me; throw me;
} }
@ -545,14 +546,13 @@ public class SmtpTransport extends Transport {
possibleSend = false; possibleSend = false;
} }
//TODO this looks rather suspicious... why is possibleSend used, and why are 5xx NOT permanent (in contrast to the log text)
me.setPermanentFailure(possibleSend); me.setPermanentFailure(possibleSend);
throw me; throw me;
} finally { } finally {
close(); close();
} }
} }
@Override @Override