Let me reply to the mailing list to keep the discussion on the detail
level away from the JIRA..

On Tue, Feb 17, 2009 at 12:29 PM, Oleg Kalnichevski (JIRA)
<[email protected]> wrote:
>
>     [ 
> https://issues.apache.org/jira/browse/MIME4J-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
>  ]
>
> Oleg Kalnichevski updated MIME4J-118:
> -------------------------------------
>
>    Attachment: mime4j-118.patch
>
> Here is the first cut at fixing the problem with charset coding in MIME 
> fields. The significant changes are
>
> (1) EntityStateMachine#getField() returns ByteArrayBuffer instead of a String
> (2) ContentHandler#field takes ByteArrayBuffer instead of a String

Your patch does not look bad, but:

I have a feeling that it will not help with MIME4J-116, maybe on the
contrary. You say you do not want AbstractEntity to create Field
instances yet you give no rationalization for your opinion.. I don't
see how the ByteArrayBuffer can help with the unnecessary duplicate
field parsing.

I have no problem with small changes one at a time. But it does not
hurt to keep an eye on related issues in the process.

Also I don't like that ByteArrayBuffer is a mutable class (and yes, I
am aware that byte[] is mutable too). Please consider that Field is
designed to be immutable. This is an important aspect because a Field
may be shared between multiple messages. So if you refactor Field to
store a ByteArrayBuffer please make sure that the ByteArrayBuffer does
not get exposed publicly.

Maybe we should introduce an immutable object that holds a byte array;
similar to what String is for a character array. That would still not
help with #116 though..

Markus

> If these changes are okay with everyone I'll proceed with refactoring and 
> change Field and friends to utilize ByteArrayBuffer for storing raw field 
> content.
>
> Oleg
>
>
>> MIME stream parser handles non-ASCII fields incorrectly
>> -------------------------------------------------------
>>
>>                 Key: MIME4J-118
>>                 URL: https://issues.apache.org/jira/browse/MIME4J-118
>>             Project: JAMES Mime4j
>>          Issue Type: Bug
>>            Reporter: Oleg Kalnichevski
>>            Assignee: Oleg Kalnichevski
>>             Fix For: 0.6
>>
>>         Attachments: mime4j-118.patch
>>
>>
>> Presently MIME stream parser handles non-ASCII fields incorrectly. Binary 
>> field content gets converted to its textual representation too early in the 
>> parsing process using simple byte to char cast. The decision about 
>> appropriate char encoding should be left up to individual ContentHandler 
>> implementations.
>> Oleg
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.

Reply via email to