You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Antony Bowesman <ad...@teamware.com> on 2008/03/18 01:23:58 UTC
Bug in Message.MessageBuilder
The Message.MessageBuilder class implements ContentHandler, but when parsing a
multipart content type, never sets the subtype, so the Multipart object is
always subtype "alternative".
As the ContentTypeField throws away the main/subtypes and combines them into
mimeType, shouldn't the startMultipart handler do something like
public void startMultipart(BodyDescriptor bd) {
expect(Entity.class);
Entity e = (Entity) stack.peek();
Multipart multiPart = new Multipart();
-->> multipart.setSubType(bd.getMimeType().substring(10));
e.setBody(multiPart);
stack.push(multiPart);
}
Antony
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: Bug in Message.MessageBuilder
Posted by Antony Bowesman <ad...@teamware.com>.
Hi Robert,
> i'm a little confused: i can't find this code in
> http://svn.apache.org/repos/asf/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Message.java
The startMultipart code does exist in your above link. All I did above was add
the line as a quick hack test.
-->> multipart.setSubType(bd.getMimeType().substring(10));
Test case and JIRA issue created.
Antony
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: Bug in Message.MessageBuilder
Posted by Robert Burrell Donkin <ro...@gmail.com>.
hi antony
On Tue, Mar 18, 2008 at 12:23 AM, Antony Bowesman <ad...@teamware.com> wrote:
> The Message.MessageBuilder class implements ContentHandler, but when
> parsing a
> multipart content type, never sets the subtype, so the Multipart object is
> always subtype "alternative".
>
> As the ContentTypeField throws away the main/subtypes and combines them
> into
> mimeType, shouldn't the startMultipart handler do something like
>
> public void startMultipart(BodyDescriptor bd) {
> expect(Entity.class);
>
> Entity e = (Entity) stack.peek();
> Multipart multiPart = new Multipart();
> -->> multipart.setSubType(bd.getMimeType().substring(10));
> e.setBody(multiPart);
> stack.push(multiPart);
> }
i'm a little confused: i can't find this code in
http://svn.apache.org/repos/asf/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Message.java
if you're using the latest code, then a patch would be easier for me to
understand. if you're not using the latest code, please checkout trunk,
build then retry. if you still have the problem then it'd be great if you
could create and contribute (https://issues.apache.org/jira/browse/MIME4J) a
unit test case that demonstrates the problem.
- robert