Skip to content

Commit

Permalink
#16 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Yegor Bugayenko committed Jan 8, 2015
1 parent 274da08 commit 1df8a7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
27 changes: 5 additions & 22 deletions src/main/java/com/jcabi/email/Envelope.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ public Message unwrap() {
@EqualsAndHashCode(of = "encs")
@Loggable(Loggable.DEBUG)
final class MIME implements Envelope {
/**
* Original envelope.
*/
private final transient Envelope origin;
/**
* List of stamps.
*/
Expand All @@ -111,43 +107,32 @@ final class MIME implements Envelope {
* @since 1.3
*/
public MIME() {
this(Envelope.EMPTY, new Array<Stamp>(), new Array<Enclosure>());
this(new Array<Stamp>(), new Array<Enclosure>());
}
/**
* Ctor.
* @param env Original envelope
* @since 1.5
*/
public MIME(final Envelope env) {
this(env, new Array<Stamp>(), new Array<Enclosure>());
}
/**
* Ctor.
* @param stmps Stamps
* @param list List of enclosures
*/
public MIME(final Iterable<Stamp> stmps,
final Iterable<Enclosure> list) {
this(
Envelope.EMPTY, new Array<Stamp>(stmps),
new Array<Enclosure>(list)
Envelope.MIME.class.cast(env).stamps,
Envelope.MIME.class.cast(env).encs
);
}
/**
* Ctor.
* @param env Original envelope
* @param stmps Stamps
* @param list List of enclosures
*/
public MIME(final Envelope env, final Iterable<Stamp> stmps,
public MIME(final Iterable<Stamp> stmps,
final Iterable<Enclosure> list) {
this.origin = env;
this.stamps = new Array<Stamp>(stmps);
this.encs = new Array<Enclosure>(list);
}
@Override
public Message unwrap() throws IOException {
final Message msg = this.origin.unwrap();
final Message msg = Envelope.EMPTY.unwrap();
final Multipart multi = new MimeMultipart("alternative");
try {
for (final Enclosure enc : this.encs) {
Expand All @@ -170,7 +155,6 @@ public Message unwrap() throws IOException {
*/
public Envelope.MIME with(final Stamp stamp) {
return new Envelope.MIME(
this.origin,
this.stamps.with(stamp),
this.encs
);
Expand All @@ -183,7 +167,6 @@ public Envelope.MIME with(final Stamp stamp) {
*/
public Envelope.MIME with(final Enclosure enc) {
return new Envelope.MIME(
this.origin,
this.stamps,
this.encs.with(enc)
);
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/jcabi/email/EnvelopeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
* @author Yegor Bugayenko ([email protected])
* @version $Id$
* @since 1.4
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
public final class EnvelopeTest {

Expand Down

0 comments on commit 1df8a7d

Please sign in to comment.