1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -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;
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;
/**
* Sets the content transfer encoding (7bit, 8bit, quoted-printable or base64).
*/
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;
}

View File

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

View File

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

View File

@ -511,6 +511,7 @@ public class SmtpTransport extends Transport {
if (mLargestAcceptableMessage > 0 && ((LocalMessage)message).hasAttachments()) {
if (message.calculateSize() > mLargestAcceptableMessage) {
MessagingException me = new MessagingException("Message too large for server");
//TODO this looks rather suspicious... shouldn't it be true?
me.setPermanentFailure(possibleSend);
throw me;
}
@ -545,14 +546,13 @@ public class SmtpTransport extends Transport {
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);
throw me;
} finally {
close();
}
}
@Override