MIMEEntity, setContentFromText: body disappearing

Is it possible to use MIMEEntity.setContentFromText to modify an existing text/html part of an existing mime/multipart Body?

I have a Document with a RichText item (called Body) and other fields. Body has “store content as html and mime” property set.

I need to modify the Notes generated html for Body, and SAVE it (not send).

I’m using java, and MIMEEntity.setContentFromText().

It works for local databases (with 1 attachment), but if I run it on a db located on server (via Notes),

and the document has attachments, the Body disappears: no empty body, there isn’t any item called body!

With more than 1 attachment (on local db), the attachments collapse: I get a 30kb big file instead of 3 10kb small files.

I tried with a java agent like:

boolean bCM = session.isConvertMime();

session.setConvertMime(false);

Document noteThis = agentContext.getDocumentContext();

try {

MIMEEntity mime = noteThis.getMIMEEntity();

doMIMEExploration(session, mime);

noteThis.save(true, false);

} catch…

session.setConvertMime(bCM);

public void doMIMEExploration(Session sessThis, MIMEEntity mime) throws Exception {

if (mime != null) {

    if (isTextHTMLAndNotAttachment(mime)) {

        try {

            String sBody4 = mime.getContentAsText();

            String sConvertedBody = MIMEConverter.convertText(sBody4); // a class of mine

            if (sConvertedBody != null) {

                Stream str = sessThis.createStream();

str.writeText(sConvertedBody);

//1=chr(10), 2=chr(13), 0=chr(13)+chr(10)

str.writeText(“”, 0); str.writeText(“”, 0);

					mime.setContentFromText(str, "text/html; charset=\"iso-8859-1\"", MIMEEntity.ENC_IDENTITY_8BIT);



					str.close();

            }

        } catch...

    }           

    doMIMEExploration(sessThis, mime.getFirstChildEntity());

    doMIMEExploration(sessThis, mime.getNextSibling());			

}

}

Domino 6.5.3 on Windows, 6.5.1 on Win and Linux, Notes 6.5.3.

Any ideas?

Thanks,

stefano